# 1.7 Stiffness and Implicit Methods

## 1.7.5 Apply Newton-Raphson

Measurable Outcome 1.4, Measurable Outcome 1.13, Measurable Outcome 1.14, Measurable Outcome 1.19

The value of \(u_1\) will be (3 significant digits):

Consider the system of ODEs \(\dot{u}_1 = \sin (u_2), \dot{u_2}=\cos (u_1)\) starting from an initial condition of \(u_1=0, u_2=\pi /2\). Implement trapezoidal integration with a timestep of \({\Delta t}=0.1.\) Ensure that the 2-norm of the residual is less than \(10^{-5}\) to ensure that the Newton-Rhapson iteration has converged. After one timestep

The value of \(u_1\) will be:

Exercise 1
Numerical Response

The value of \(u_2\) will be:

Exercise 2
Numerical Response

Answer:

The following code can be used to solve the problem:

dt=0.1; u0=[0; pi/2]; w = u0; normR=100; while normR > 1e-5 R = w - u0 - dt/2*([sin(w(2)); cos(w(1))] + [sin(u0(2)); cos(u0(1))]); J = [0 cos(w(2)); -sin(w(1)) 0]; dw = (eye(2)-dt/2*J)R; normR = norm(R);