I'm curious, how do common trig functions get implemented for dual numbers? One way would be to use the power series definition, but that seems inefficient
Implementing trig functions for dual numbers
2.3k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 3 best solutions below
On
You can also start from the argument addition formulas and proceed by evaluating only $\sin (\epsilon) , \cos (\epsilon), \tan (\epsilon), \cot(\epsilon)$. Then you can evaluate the functions from their Taylor expansions. That is $\cos (\epsilon) = 1$, $\sin (\epsilon)= \epsilon$, $\tan (\epsilon)= \epsilon $ but $\cot (\epsilon)$ is undefined because $\epsilon$ does not have an inverse.
On
Given that $\epsilon^2 = 0$ with $\epsilon \neq 0$, one can use Taylor expansion:
$$ f(a + b\epsilon) = f(a) + b\epsilon f'(a) $$
For trigonometric functions:
$$ \cos\left({a+b\epsilon}\right) = \cos{a} - b\epsilon\sin{a} \\ \sin\left({a+b\epsilon}\right) = \sin{a} + b\epsilon\cos{a} \\ \tan\left({a+b\epsilon}\right) = \tan{a} + b\epsilon\sec^2{a} \\ ...\text{etc}. $$
Suppose $x=u+v\varepsilon$ where $u,v\in\mathbb C$ and $\varepsilon\ne0=\varepsilon^2$. \begin{align} \sin x & = x - \frac{x^3} 6 + \frac{x^5}{120} - \frac{x^7}{5040} + \cdots \\[8pt] & = (u+v\varepsilon) - \frac{u^3 + 3u^2 v\varepsilon}6 + \frac{u^5 + 5u^4 v\varepsilon}{120} - \frac{u^7+7u^6 v\varepsilon}{5040} + \cdots \tag 1 \\[8pt] & = \sin u + v\varepsilon\left(1 - \frac{u^2}{2} + \frac{u^4}{24} - \frac{u^6}{720} +\cdots\right) \\[8pt] & = \sin u + v\varepsilon\cos u. \end{align} In $(1)$, I am simply applying the binomial theorem, and most of the terms vanish.
And so on $\ldots\ldots$
Power series are used here not for computing, but for establishing the trigonometric identity $$ \sin(u + v\varepsilon) = \sin u + v\varepsilon\cos u $$ whenever $\varepsilon$ is a non-zero object whose square is $0$ and there's enough commutativity. For example, when you multiply matrices, they don't commute with each other but when you multiply a matrix by a scalar, those do.