Solving Ordinary Non Linear Differential Equations
Introduction
Let
Function
is continuous on is lipschitz on
Euler Algorithm (1768)
In general, we can't find the exact solution
Exercise [Non Linear Equation of order
Let us given the following Cauchy problem:
-
Solve this Cauchy problem with the scalar Euler algorithm. Draw the solution curve with Python. For this you have to define the following function:
-
Solve this Cauchy problem with the scalar Runge-Kutta of order
algorithm (see Runge Kutta Algorithms ). -
Solve this Cauchy problem with the scalar Runge-Kutta of order
algorithm. -
Solve this Cauchy problem with the second order Adams-Moulton algorithm.
import numpy as np
import matplotlib.pyplot as plt
""" ODE function """
def f(t,y):
return 1+y*y
""" Euler Algorithm"""
def Euler(y0,a,b,nb):
h=(b-a)/nb
t=a
X=[a]
Y=[y0]
y1=y0
for i in range(1,nb):
#TO DO
Y.append(y2)
X.append(t)
y1=y2
return X,Y
y0= 0.0
a = 0.0
b = 1.0
niter = 150
x,y = Euler(y0,a,b,niter)
plt.plot(x,y,'r', label=r"Euler method", linestyle='--')
plt.legend(loc='upper left', bbox_to_anchor=(1.1, 0.95),fancybox=True, shadow=True)
plt.show()
Exercise [Ricatti (1712) Non Linear Equation of order
Let us given the following Cauchy problem:
-
Solve this Cauchy problem with the scalar Euler and Runge-Kutta algorithm.
-
Draw the solution curves with Python.
-
Compare the approximted values of
with the reference solution
0.041 791 146 154 681 863 220 76
Exercise [Numerical instability]
Let us given the following Cauchy problem:
- Use the fourth-order Runge-Kutta method with step
to solve this problem. - Compare the result with the analytical solution
.
Let us give
Exercise [Non Linear Equation of order
We want to solve this second order non linear differential equation:
-
Solve this Cauchy problem with the Euler vector algorithm.
-
Solve this Cauchy problem with the Runge-Kutta of order
algorithm. -
Solve this Cauchy problem with the Runge-Kutta of order
algorithm. -
Solve this Cauchy problem with the second order Adams-Moulton algorithm.
import numpy as np
""" Euler Vector Algorithm"""
def F(t,V):
L=[V[1], # TO DO]
return np.array(L)
def NEuler(y0,a,b,nb):
h=(b-a)/nb
t=a
X=[a]
Y=[V0[0]]
V1=V0
for i in range(1,nb):
#TO DO
t=t+h
Y.append(V2[0])
X.append(t)
V1=V2
return X,Y

Exercise [Mass Spring]
Consider the mass–spring system where dry friction is present between the block
and the horizontal surface. The frictional force has a constant magnitude
- Write the differential equation of the motion of the block
- If the block is released from rest at
, verify by numerical integration that the next positive peak value of is . This relationship can be derived analytically.
Exercise [Iron block]
The magnetized iron block of mass
- Write the differential equation of the motion of the mass
- Determine the amplitude and the period of the motion by numerical integration
Exercise [Magnus Effect applied to a ball]
On June 3, 1997, Roberto Carlos scored against France football team a free kick goal with an improbable effect.
We want to simulate in this exercice what happened that day. For this, we set:
-
: the air density -
the radius of the ball -
: the mass of the ball -
: the location of the ball at -
: the initial speed of the ball -
: the speed of the ball at . -
: the speed vector of the ball at . -
: the angular velocity of the ball which is assumed to be constant during the trajectory -
: the angle between and -
, : are the initial angles of the force applied to the ball

- its weight
- a friction force:
, where - a lift force
.
-
Define the differential equation apply to the ball.
-
Define the initial conditions.
-
Solve this Cauchy problem with the Runge-Kutta of order
algorithm. -
Solve this Cauchy problem with the second order Adams-Moulton algorithm.
Runge-Kutta Algorithms
Runge-Kutta of order
We want to solve the following Cauchy problem:
- if
then we obtain the previous Euler method - if
and we obtain the modified Euler method where - if
and then we obtain the Euler-Cauchy method where .
The fourth-order Runge–Kutta method is obtained from the Taylor series along the
samelines as the second-ordermethod. Since the derivation is rather long and not very
instructive, we skip it. The final form of the integration formula again depends on the
choice of the parameters; that is, there is no unique Runge–Kutta fourth-order formula.
The most popular version, which is known simply as the Runge–Kutta method, entails
the following sequence of operations:
Multi-step Algorithms
For all
- If
then we have an explicit method. - If
then we have an implicit method.
If we integrate the differential equation we have:
- To calculate
we need to know the value then we have implicit methods. To solve then, we can approximate by by using an explicit method and insert this value in the implicit schema (correction step). - Usually the implicit methods are more robust than the explicit ones.
Adams-Bashforth Algorithm
Order 2 :
References
- Dennis, J.E., and Schnabel, R.B. 1983, Numerical Methods for Unconstrained Optimization and Nonlinear Equations; reprinted 1996 (Philadelphia: S.I.A.M.)