I'm working on some code which utilizes Newton's method, and I would like to take advantage of dual numbers to simplify taking the derivative. I've worked out a class definition Dual which works great for polynomials, pow (where either base or exponent is real) exp, and log.
However, I am a bit stymied at raising a dual number to the power of another dual number, e.g.
$(a+b\varepsilon)^{(c+d\varepsilon)}$
I used the general form derived from the Taylor series $f(a+b\varepsilon) = f(a) + bf'(a)\varepsilon$ to derive the rules for $x^n$ and $n^x$ where $n$ is real and $x$ is dual. For those, I got:
$x^n = a^n + bna^{n-1}$ , where $ x = a+b\varepsilon$
$n^y = n^c + d\ln(n)n^{c}$ , where $ y = c+d\varepsilon$
Substituting and simplifying, I end up with:
$x^y = a^c + (d\ln(a)a^c + bca^{c-1})\varepsilon$
This seems to work right in my code, but I do not know if this is actually correct. The implementations of exp and pow work properly with this more general code, and $\varepsilon^\varepsilon = 1 + NaN\varepsilon$, which is a good-ish sign (if I got something well-formed, that would be more troubling).
Is this formula valid?
$\def\e{\varepsilon}$\begin{align*} (a+b\e)^{c+d\e} &= \exp((c+d\e)\ln(a+b\e)) & x=e^{\ln x} \\ &=\exp((c+d\e)(\ln a+\ln(1+b\e/a))) \\ &=\exp((c+d\e)(\ln a+b\e/a)) & \ln(1+x)=x+\mathrm{h.o.} \\ &=\exp(c\ln a+\e(d\ln a+bc/a))\\ &=a^c e^{\e(d\ln a+bc/a)} \\ &=a^c (1+\e(d\ln a+bc/a)). & e^x=1+x+\mathrm{h.o.} \end{align*}