# Nonlinear finite elements/Homework11/Solutions/Problem 1/Part 16
## Problem 1: Part 16: Newton iterations

Let the nonlinear equations be $g(\Delta \gamma )=0$. Recall that the Newton method requires that we iterate using the formula
    $\Delta \gamma _{r+1}=\Delta \gamma _{r}-{\cfrac {g(\Delta \gamma _{r})}{\cfrac {dg(\Delta \gamma _{r})}{d\Delta \gamma }}}$
where $r$ is the Newton iteration number. Derive an expression for the derivative of $g$ that is required in the above formula.
Let us find the derivatives term by term. For the first term
    ${\cfrac {d}{d\Delta \gamma }}\left[9~\mu ^{2}~(\Delta \gamma )^{2}\right]=18~\mu ^{2}~\Delta \gamma$
For the second term
    ${\cfrac {d}{d\Delta \gamma }}\left[6~\mu ~{\sqrt {\cfrac {3}{2}}}~\Delta \gamma ~\mathbf {s} _{n+1}^{\text{trial}}:\mathbf {n} _{n}\right]=6~\mu ~{\sqrt {\cfrac {3}{2}}}~\mathbf {s} _{n+1}^{\text{trial}}:\mathbf {n} _{n}$
For the fourth term
    ${\cfrac {d}{d\Delta \gamma }}\left[{\cfrac {3}{2}}~\mathbf {s} _{n+1}^{\text{trial}}:\mathbf {s} _{n+1}^{\text{trial}}\right]=0$
For the third term
    ${\cfrac {d}{d\Delta \gamma }}\left[\left\{\sigma _{0}+B\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n}\right\}^{2}\left\{1-\left({\cfrac {T_{n}+{\sqrt {\cfrac {3}{2}}}~{\cfrac {\chi ~\Delta \gamma }{\rho _{n}~C_{p}}}\lVert \mathbf {s} _{n}\rVert _-T_{0}}{T_{m}-T_{0}}}\right)\right\}^{2}\right]={\cfrac {d}{d\Delta \gamma }}[P_{n}~Q_{n}]={\cfrac {dP_{n}}{d\Delta \gamma }}~Q_{n}+{\cfrac {dQ_{n}}{d\Delta \gamma }}~P_{n}$
Now,
    ${\begin{aligned}{\cfrac {dP_{n}}{d\Delta \gamma }}&={\cfrac {d}{d\Delta \gamma }}\left[\left\{\sigma _{0}+B\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n}\right\}^{2}\right]\\&=2~\left\{\sigma _{0}+B\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n}\right\}{\cfrac {d}{d\Delta \gamma }}\left[\sigma _{0}+B\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n}\right]\\&=2~\left\{\sigma _{0}+B\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n}\right\}\left[n~B~\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n-1}\right]{\cfrac {d}{d\Delta \gamma }}\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)\\&=2~\left\{\sigma _{0}+B\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n}\right\}\left[n~B~\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n-1}\right]\left({\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)\\&=2~n~B~\left({\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n-1}\left[\sigma _{0}+B\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n}\right]\end{aligned}}$
Similarly,
    ${\begin{aligned}{\cfrac {dQ_{n}}{d\Delta \gamma }}&={\cfrac {d}{d\Delta \gamma }}\left[\left\{1-\left({\cfrac {T_{n}+{\sqrt {\cfrac {3}{2}}}~{\cfrac {\chi ~\Delta \gamma }{\rho _{n}~C_{p}}}\lVert \mathbf {s} _{n}\rVert _-T_{0}}{T_{m}-T_{0}}}\right)\right\}^{2}\right]\\&=2~\left\{1-\left({\cfrac {T_{n}+{\sqrt {\cfrac {3}{2}}}~{\cfrac {\chi ~\Delta \gamma }{\rho _{n}~C_{p}}}\lVert \mathbf {s} _{n}\rVert _-T_{0}}{T_{m}-T_{0}}}\right)\right\}{\cfrac {d}{d\Delta \gamma }}\left[-\left({\cfrac {T_{n}+{\sqrt {\cfrac {3}{2}}}~{\cfrac {\chi ~\Delta \gamma }{\rho _{n}~C_{p}}}\lVert \mathbf {s} _{n}\rVert _-T_{0}}{T_{m}-T_{0}}}\right)\right]\\&=-2~{\sqrt {\cfrac {3}{2}}}~\left\{1-\left({\cfrac {T_{n}+{\sqrt {\cfrac {3}{2}}}~{\cfrac {\chi ~\Delta \gamma }{\rho _{n}~C_{p}}}~\lVert \mathbf {s} _{n}\rVert _-T_{0}}{T_{m}-T_{0}}}\right)\right\}~\left({\cfrac {\chi ~\lVert \mathbf {s} _{n}\rVert _}{\rho _{n}~C_{p}~(T_{m}-T_{0})}}\right)\\&=-{\sqrt {6}}~\left({\cfrac {\chi ~\lVert \mathbf {s} _{n}\rVert _}{\rho _{n}~C_{p}}}\right)~\left[{\cfrac {T_{m}-T_{n}-{\sqrt {\cfrac {3}{2}}}~{\cfrac {\chi ~\Delta \gamma }{\rho _{n}~C_{p}}}~\lVert \mathbf {s} _{n}\rVert _}{(T_{m}-T_{0})^{2}}}\right]\end{aligned}}$
Therefore, the full expression for the derivative is
    ${\begin{aligned}{\cfrac {dg(\Delta \gamma _{r})}{d\Delta \gamma }}&=18~\mu ^{2}~\Delta \gamma -6~\mu ~{\sqrt {\cfrac {3}{2}}}~\mathbf {s} _{n+1}^{\text{trial}}:\mathbf {n} _{n}\\&\qquad -2~n~B~\left({\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n-1}\left[\sigma _{0}+B\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n}\right]\left[1-\left({\cfrac {T_{n}+{\sqrt {\cfrac {3}{2}}}~{\cfrac {\chi ~\Delta \gamma }{\rho _{n}~C_{p}}}\lVert \mathbf {s} _{n}\rVert _-T_{0}}{T_{m}-T_{0}}}\right)\right]^{2}\\&\qquad +{\sqrt {6}}~\left({\cfrac {\chi ~\lVert \mathbf {s} _{n}\rVert _}{\rho _{n}~C_{p}}}\right)~\left[{\cfrac {T_{m}-T_{n}-{\sqrt {\cfrac {3}{2}}}~{\cfrac {\chi ~\Delta \gamma }{\rho _{n}~C_{p}}}~\lVert \mathbf {s} _{n}\rVert _}{(T_{m}-T_{0})^{2}}}\right]\left[\sigma _{0}+B\left(\alpha _{n}+\Delta \gamma ~{\cfrac {{\boldsymbol {\varepsilon }}_{n}^{p}:\mathbf {n} _{n}}{\lVert {\boldsymbol {\varepsilon }}_{n}^{p}\rVert _}}\right)^{n}\right]^{2}\end{aligned}}$