# Implementing backward Euler with a nonlinear system

I'm trying to implement a backward Euler method in a situation when I have a nonlinear system of equations, and I'm having some trouble. My set up is as follows:

I have $\vec{f}(\vec{u}, t) = \begin{pmatrix} f_1(p(t), v(t), t) \\ f_2(p(t), v(t), t)\end{pmatrix}$.

$f_1, f_2$ are both nonlinear functions of $t, p(t)$ and $v(t)$, where $p, v$ are unknown functions of $t$.

The update scheme for backward Euler is $U^{n+1} = U^n + \Delta t f(t^{n+1}, U(t^{n+1}))$

It was suggested that I Taylor expand $f$ around $t^n, U(t^n)$.

Then my linearized update scheme, I believe, should be:

$U^{n+1} = U^{n} + \Delta t\big{(} f(t^n, U^n) + \Delta t \frac{Df}{Dt}\big{)}$.

I think my issue is the last term. I am computing it as $\frac{df}{dt} + J(t^n, U^n)\cdot f(t^n, U^n)$ where $J(t^n, U^n)$ is the Jacobian evaluated at $t^n, U^n$, and $\frac{df}{dt}$ is the function with the derivative taken only with respect to explicit $t$.

I have two issues: 1) It was suggested I would need to invert something to find the update. As it stands, no inversion is necessary. I simply add up the vectors on the right to get the left hand side 2) My answer is wrong; obviously a big problem.

I obviously don't want the answer (and haven't provided the details of the functions in any case, so you can't give it to me), but I do want to make sure I'm going about deriving this system the correct way. Am I missing something?

• What ODE are you working with? Is it $\frac{d\vec{u}}{dt} = \vec{f}(\vec{u},t)$ with $\vec{u}(t) = (p(t), v(t))^\top$, or something else? – Kyle Mar 18 '18 at 4:49

You have the wrong idea of the Taylor expansion. It is not the total time derivative, as that would also have to be applied to the left side. It simply is $$u_{n+1}\approx u_n+Δt\left(f(u_n,t_n)+\frac∂{∂u}f(u_n,t_n)(u_{n+1}-u_n)+\frac∂{∂t}f(u_n,t_n)Δt\right)$$ This should give a result that is close to the most simple Rosenbrock method.
For better precision, solve the implicit equation for $u_{n+1}$ using a Newton-like method. You look for the solution of the equation $$0=F(U)=U-hf(U,t_{n+1})-u_n.$$ The derivative of that function is approximately $F'(U)\approx I-hJ_n=I-hf_u(u_n,t_n)$ which is good enough for the simplified Newton method $$U^{[j+1]} = U^{[j]}-(I-hJ_n)^{-1}F(U^{[j]}).$$ One might be able to keep the same derivative matrix and its factorization for multiple steps, as the simplified Newton method only demands a half-ways good approximation of the derivative to yield linear convergence to the solution. Observing the speed of convergence can be used to tell of when it is necessary to refresh the derivative matrix.
• "Linearize using Taylor" and "Newton's method" are the same thing at the level of ideas. You can of course in every step compute the exact derivative $F'(U)$ and thus obtain quadratic convergence. But with a suitable predictor that is too much effort for too little gain. – LutzL Mar 17 '18 at 18:34
• Yes, and I understand that. But my assignment isn't to render a judgement about whether this is a good way of finding the solution. My assignment is to follow instructions and Taylor expand $f$. If you can help with that, then that's great. Otherwise, thanks for you time. – BenL Mar 17 '18 at 18:40