Key Word(s): Automatic differentiation, Forward mode, Dual numbers
Lecture 11 Exercise Solutions¶
Exercise 1¶
Using dual numbers, find the derivative of $$ y = e^{x^{2}}.$$ Show your work!
Replace $x$ with $a + b\epsilon$. Then, \begin{align*} y &= e^{\left(a + b\epsilon\right)^{2}} \\ &= e^{a^{2}}e^{2ab\epsilon}e^{b^{2}\epsilon^{2}} \\ &= e^{a^{2}}e^{2ab\epsilon} \qquad \left(\epsilon^{2} = 0\right) \\ &= e^{a^{2}}\left[1 + 2ab\epsilon + \dfrac{\left(2ab\epsilon\right)^{2}}{2} + \cdots\right] \\ &= e^{a^{2}} + 2ae^{a^{2}}b\epsilon \qquad \left(\epsilon^{2} = 0\right). \end{align*} So the derivative evaluated at $a$ is $2ae^{a^{2}}$.