feat: finish arcus functions
|
@ -3,3 +3,4 @@
|
||||||
|
|
||||||
npx pretty-quick --staged
|
npx pretty-quick --staged
|
||||||
node .husky/scripts/cleanMaths.js
|
node .husky/scripts/cleanMaths.js
|
||||||
|
git add .
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from cmath import e, sqrt, log
|
from cmath import e, pi, sqrt, log
|
||||||
from _helpers import floatInput
|
from _helpers import floatInput
|
||||||
|
|
||||||
i = sqrt(-1)
|
i = sqrt(-1)
|
||||||
|
|
||||||
compute = lambda numerator, denominator: (numerator / denominator).real
|
compute = lambda numerator, denominator: (numerator / denominator).real
|
||||||
ln = lambda x: log(x, e)
|
computeInverse = lambda x: (-i * log(x, e)).real
|
||||||
|
|
||||||
sin = lambda x: compute(pow(e, i * x) - pow(e, -i * x), 2 * i)
|
sin = lambda x: compute(pow(e, i * x) - pow(e, -i * x), 2 * i)
|
||||||
cos = lambda x: compute(pow(e, i * x) + pow(e, -i * x), 2)
|
cos = lambda x: compute(pow(e, i * x) + pow(e, -i * x), 2)
|
||||||
|
@ -13,14 +13,20 @@ csc = lambda x: 1 / sin(x)
|
||||||
sec = lambda x: 1 / cos(x)
|
sec = lambda x: 1 / cos(x)
|
||||||
cot = lambda x: 1 / tan(x)
|
cot = lambda x: 1 / tan(x)
|
||||||
|
|
||||||
arcsin = lambda x: (-i * ln((i * x) + sqrt(1 - pow(x, 2)))).real
|
arcsin = lambda x: computeInverse((i * x) + sqrt(1 - pow(x, 2)))
|
||||||
|
arccos = lambda x: computeInverse(x + sqrt(pow(x, 2) - 1))
|
||||||
|
arctan = lambda x: computeInverse((i - x) / (i + x)) / 2
|
||||||
|
arccsc = lambda x: computeInverse((pow(x, -1) * i) + sqrt(1 - pow(x, -2)))
|
||||||
|
arcsec = lambda x: computeInverse((pow(x, -1)) + sqrt(pow(x, -2) - 1))
|
||||||
|
arccot = lambda x: computeInverse((x + i) / (x - i)) / 2
|
||||||
|
|
||||||
# todo: finish arc functions
|
# todo: hyperbolic functions
|
||||||
arccos = lambda x: None
|
|
||||||
arctan = lambda x: None
|
# todo: hyperbolic inverse functions
|
||||||
arccsc = lambda x: (-i * (ln((pow(x, -1) * i) + sqrt(1 - pow(x, -2))))).real
|
|
||||||
arcsec = lambda x: None
|
# todo: hyperbolic reciprocal functions
|
||||||
arccot = lambda x: None
|
|
||||||
|
# todo: hyperbolic inverse reciprocal functions
|
||||||
|
|
||||||
radians = floatInput("Please enter an amount of radians: ")
|
radians = floatInput("Please enter an amount of radians: ")
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,8 @@
|
||||||
\LoadClass[17pt]{extarticle}
|
\LoadClass[17pt]{extarticle}
|
||||||
\pagenumbering{gobble}
|
\pagenumbering{gobble}
|
||||||
|
|
||||||
|
\newcommand{\euler}{\begin{gather*}
|
||||||
|
\text{By Euler's formula:} \\
|
||||||
|
e^{i\theta} = cos(\theta) + i\sin(\theta) \\
|
||||||
|
e^{-i\theta} = cos(\theta) - i\sin(\theta)
|
||||||
|
\end{gather*}}
|
||||||
|
|
BIN
maths/trigometric functions/cos.png
Normal file
After Width: | Height: | Size: 36 KiB |
27
maths/trigometric functions/cos.tex
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
\documentclass{../style}
|
||||||
|
\usepackage{amsmath}
|
||||||
|
\usepackage{amssymb}
|
||||||
|
\begin{document}
|
||||||
|
\euler
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\therefore \cos(\theta) = \frac{e^{i\theta} + e^{-i\theta}}{2}
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\text{let} \quad \cos(\theta) = x \\
|
||||||
|
2x = e^{i\theta} + e^{-i\theta} \\
|
||||||
|
2xe^{i\theta} = (e^{i\theta})^2 + 1 \\
|
||||||
|
(e^{i\theta})^2 + (-2x)e^{i\theta} + 1 = 0
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
e^{i\theta} = \frac{-(-2x) \pm \sqrt{(-2x)^2 - 4}}{2} = x \pm \sqrt{x^2 - 1} \\
|
||||||
|
i\theta = \ln(x \pm \sqrt{x^2 - 1}) \\
|
||||||
|
\theta = -i\ln(x \pm \sqrt{x^2 - 1})
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\therefore \arccos(\theta) = -i\ln(\theta \pm \sqrt{\theta^2 - 1})
|
||||||
|
\end{gather*}
|
||||||
|
\end{document}
|
BIN
maths/trigometric functions/cot-1.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
maths/trigometric functions/cot-2.png
Normal file
After Width: | Height: | Size: 26 KiB |
29
maths/trigometric functions/cot.tex
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
\documentclass{../style}
|
||||||
|
\usepackage{amsmath}
|
||||||
|
\usepackage{amssymb}
|
||||||
|
\begin{document}
|
||||||
|
\euler
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\therefore \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i} \\
|
||||||
|
\cos(\theta) = \frac{e^{i\theta} + e^{-i\theta}}{2} \\
|
||||||
|
\tan(\theta) = \frac{\sin(\theta)}{\cos{\theta}} = -\frac{i(-1 + e^{2i\theta})}{1 + e^{2i\theta}} \\
|
||||||
|
\cot(\theta) = \frac{1}{\tan(\theta)} = -\frac{1 + e^{2i\theta}}{i(-1 + e^{2i\theta})}
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\text{let} \quad \cot(\theta) = x \\
|
||||||
|
x(i + ie^{2i\theta}) = -1(1 + e^{2i\theta}) \\
|
||||||
|
ix + ixe^{2i\theta} = -e^{2i\theta} - 1 \\
|
||||||
|
ixe^{2i\theta} + e^{2i\theta} = -1 - ix \\
|
||||||
|
(ix + 1)e^{2i\theta} = -1 - ix \\
|
||||||
|
e^{2i\theta} = -\frac{1 - ix}{1 + ix} \\
|
||||||
|
2i\theta = \ln(\frac{x + i}{x - i}) \\
|
||||||
|
i\theta = \frac{1}{2}\ln(\frac{x + i}{x - i}) \\
|
||||||
|
\theta = -\frac{i}{2}\ln(\frac{x + i}{x - i})
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\therefore \text{arccot}(\theta) = -\frac{i}{2}\ln(\frac{\theta + i}{\theta - i})
|
||||||
|
\end{gather*}
|
||||||
|
\end{document}
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 38 KiB |
|
@ -2,11 +2,7 @@
|
||||||
\usepackage{amsmath}
|
\usepackage{amsmath}
|
||||||
\usepackage{amssymb}
|
\usepackage{amssymb}
|
||||||
\begin{document}
|
\begin{document}
|
||||||
\begin{gather*}
|
\euler
|
||||||
\text{By Euler's formula:} \\
|
|
||||||
e^{i\theta} = cos(\theta) + i\sin(\theta) \\
|
|
||||||
e^{-i\theta} = cos(\theta) - i\sin(\theta)
|
|
||||||
\end{gather*}
|
|
||||||
|
|
||||||
\begin{gather*}
|
\begin{gather*}
|
||||||
\therefore \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i} \\
|
\therefore \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i} \\
|
||||||
|
@ -21,7 +17,7 @@
|
||||||
\end{gather*}
|
\end{gather*}
|
||||||
|
|
||||||
\begin{gather*}
|
\begin{gather*}
|
||||||
e^{i\theta} = \frac{-(\frac{2i}{x}) \pm \sqrt{(\frac{2i}{x})^2 - 4(1)(-1)}}{2} = x^{-1}i \pm \sqrt{1 - x^2} \\
|
e^{i\theta} = \frac{-(\frac{2i}{x}) \pm \sqrt{(\frac{2i}{x})^2 - 4(-1)}}{2} = x^{-1}i \pm \sqrt{1 - x^2} \\
|
||||||
i\theta = \ln(x^{-1}i \pm \sqrt{1 - x^2}) \\
|
i\theta = \ln(x^{-1}i \pm \sqrt{1 - x^2}) \\
|
||||||
\theta = -i\ln(x^{-1}i \pm \sqrt{1 - x^2})
|
\theta = -i\ln(x^{-1}i \pm \sqrt{1 - x^2})
|
||||||
\end{gather*}
|
\end{gather*}
|
||||||
|
|
BIN
maths/trigometric functions/sec-1.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
maths/trigometric functions/sec-2.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
29
maths/trigometric functions/sec.tex
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
\documentclass{../style}
|
||||||
|
\usepackage{amsmath}
|
||||||
|
\usepackage{amssymb}
|
||||||
|
\begin{document}
|
||||||
|
\euler
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\therefore \cos(\theta) = \frac{e^{i\theta} + e^{-i\theta}}{2} \\
|
||||||
|
\sec(\theta) = \frac{1}{\cos(\theta)} = \frac{2}{e^{i\theta} + e^{-i\theta}}
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\text{let} \quad \sec(\theta) = x \\
|
||||||
|
x(e^{i\theta} + e^{-i\theta}) = 2 \\
|
||||||
|
e^{i\theta} + e^{-i\theta} = \frac{2}{x} \\
|
||||||
|
(e^{i\theta})^2 + 1 = \frac{2}{x}e^{i\theta} \\
|
||||||
|
(e^{i\theta})^2 + (-\frac{2}{x})e^{i\theta} + 1 = 0
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
e^{i\theta} = \frac{-(-\frac{2}{x}) \pm \sqrt{(-\frac{2}{x})^2 - 4}}{2} = x^{-1} \pm \sqrt{x^{-2} - 1} \\
|
||||||
|
i\theta = \ln(x^{-1} \pm \sqrt{x^{-2} - 1}) \\
|
||||||
|
\theta = -i\ln(x^{-1} \pm \sqrt{x^{-2} - 1})
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\therefore \text{arcsec}(\theta) = -i\ln(\theta^{-1} \pm \sqrt{\theta^{-2} - 1})
|
||||||
|
\end{gather*}
|
||||||
|
\end{document}
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 38 KiB |
|
@ -2,11 +2,7 @@
|
||||||
\usepackage{amsmath}
|
\usepackage{amsmath}
|
||||||
\usepackage{amssymb}
|
\usepackage{amssymb}
|
||||||
\begin{document}
|
\begin{document}
|
||||||
\begin{gather*}
|
\euler
|
||||||
\text{By Euler's formula:} \\
|
|
||||||
e^{i\theta} = cos(\theta) + i\sin(\theta) \\
|
|
||||||
e^{-i\theta} = cos(\theta) - i\sin(\theta)
|
|
||||||
\end{gather*}
|
|
||||||
|
|
||||||
\begin{gather*}
|
\begin{gather*}
|
||||||
\therefore \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i}
|
\therefore \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i}
|
||||||
|
@ -15,12 +11,12 @@
|
||||||
\begin{gather*}
|
\begin{gather*}
|
||||||
\text{let} \quad \sin(\theta) = x \\
|
\text{let} \quad \sin(\theta) = x \\
|
||||||
2ix = e^{i\theta} - e^{-i\theta} \\
|
2ix = e^{i\theta} - e^{-i\theta} \\
|
||||||
2ie^{i\theta}x = (e^{i\theta})^2 - 1 \\
|
2ixe^{i\theta} = (e^{i\theta})^2 - 1 \\
|
||||||
(e^{i\theta})^2 + (-2ix)e^{i\theta} - 1 = 0
|
(e^{i\theta})^2 + (-2ix)e^{i\theta} - 1 = 0
|
||||||
\end{gather*}
|
\end{gather*}
|
||||||
|
|
||||||
\begin{gather*}
|
\begin{gather*}
|
||||||
e^{i\theta} = \frac{-(-2ix) \pm \sqrt{(-2ix)^2 - 4(1)(-1)}}{2} = ix \pm \sqrt{1 - x^2} \\
|
e^{i\theta} = \frac{-(-2ix) \pm \sqrt{(-2ix)^2 - 4(-1)}}{2} = ix \pm \sqrt{1 - x^2} \\
|
||||||
i\theta = \ln(ix \pm \sqrt{1 - x^2}) \\
|
i\theta = \ln(ix \pm \sqrt{1 - x^2}) \\
|
||||||
\theta = -i\ln(ix \pm \sqrt{1 - x^2})
|
\theta = -i\ln(ix \pm \sqrt{1 - x^2})
|
||||||
\end{gather*}
|
\end{gather*}
|
||||||
|
|
BIN
maths/trigometric functions/tan-1.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
maths/trigometric functions/tan-2.png
Normal file
After Width: | Height: | Size: 26 KiB |
28
maths/trigometric functions/tan.tex
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
\documentclass{../style}
|
||||||
|
\usepackage{amsmath}
|
||||||
|
\usepackage{amssymb}
|
||||||
|
\begin{document}
|
||||||
|
\euler
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\therefore \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i} \\
|
||||||
|
\cos(\theta) = \frac{e^{i\theta} + e^{-i\theta}}{2} \\
|
||||||
|
\tan(\theta) = \frac{\sin(\theta)}{\cos{\theta}} = -\frac{i(-1 + e^{2i\theta})}{1 + e^{2i\theta}}
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\text{let} \quad \tan(\theta) = x \\
|
||||||
|
x(1 + e^{2i\theta}) = -i(-1 + e^{2i\theta}) \\
|
||||||
|
x + xe^{2i\theta} = i - ie^{2i\theta} \\
|
||||||
|
xe^{2i\theta} + ie^{2i\theta} = i - x \\
|
||||||
|
e^{2i\theta}(i + x) = i - x \\
|
||||||
|
e^{2i\theta} = \frac{i - x}{i + x} \\
|
||||||
|
2i\theta = \ln(\frac{i - x}{i + x}) \\
|
||||||
|
i\theta = \frac{1}{2}\ln(\frac{i - x}{i + x}) \\
|
||||||
|
\theta = -\frac{i}{2}\ln(\frac{i - x}{i + x})
|
||||||
|
\end{gather*}
|
||||||
|
|
||||||
|
\begin{gather*}
|
||||||
|
\therefore \arctan(\theta) = -\frac{i}{2}\ln(\frac{i - \theta}{i + \theta})
|
||||||
|
\end{gather*}
|
||||||
|
\end{document}
|