Post Reply 
Automatic differentiation using dual numbers
07-07-2022, 07:40 AM (This post was last modified: 07-07-2022 07:43 AM by Ángel Martin.)
Post: #25
RE: Automatic differentiation using dual numbers
(06-21-2022 02:19 AM)Thomas Klemm Wrote:  
(06-20-2022 09:50 PM)Albert Chan Wrote:  … forget about ε … ε is a bad idea

Au contraire!
It's just that you misinterpreted the meaning of the coefficient of \(\varepsilon^2\).
Based on the Taylor series we have:

\(
\begin{align}
f(x + \varepsilon) = f(x) + {f}'(x) \cdot \varepsilon + \frac{1}{2} {f}''(x) \cdot \varepsilon^2
\end{align}
\)

Given your example:
Quote:{f, f', f''} = {1,2,3}
{g,g',g''} = {3,1,4}

… we have to calculate:

\(
\begin{align}
\left(1 + 2 \varepsilon + \frac{3}{2} \varepsilon^2 \right)\left(3 + \varepsilon + 2 \varepsilon^2 \right)
&= 3 + 7 \varepsilon + \frac{17}{2} \varepsilon^2 + \frac{11}{2} \varepsilon^3 + 3 \varepsilon^4 \\
&= 3 + 7 \varepsilon + \frac{17}{2} \varepsilon^2 \\
\end{align}
\)

… since \(\varepsilon^3 = 0\).
With this interpretation we get the correct result.

This can be extended in an analogous way for higher-order derivatives.

Sorry for coming this late to this, but I'm not sure I follow your point about higher order derivatives (I'm sure it's my own fault). By definition \(\varepsilon^2 = 0\)., right?

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Fixed Point Iteration - Thomas Klemm - 06-19-2022, 08:31 PM
RE: Automatic differentiation using dual numbers - Ángel Martin - 07-07-2022 07:40 AM



User(s) browsing this thread: 1 Guest(s)