Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

numerical methods for

differential equations and


applications

Supervisor: Camile Fraga Delfino Kunz

November 20th, 2018


What do we have for today?

Initial Value Problems (IVP);


Existence and Uniqueness of Solution;
Lipschitz continuity;
Explicit and Implicit numerical methods;
Local Truncation Errors (LTE);
Global Error;
Convergence.
IVP

The Initial Value Problem for Ordinary Differential Equations


is given by
(
u 0 (t) = f (u(t), t) , for t > t0
u(t0 ) = η

On some cases we will consider as simplicity t0 = 0, η > 0 and


f na continuous function.
Existence and Uniqueness

Linear case
For the linear case, a IVP can be written as
u 0 (t) + p(t)u(t) = q(t) plus a initial condition.
The Duhamel’s Principle states that the IVP has aunique
solution given by

1 h t
Z i
u(t) = µ(s)q(s)ds + u(t0 )
µ(t) t0

where µ(t) is given by


Z t
µ(t) = exp p(s)ds
t0
Existence
Nonlinear case
Given the Initial Value Problem
(
u 0 (t) = f (u(t), t) , for t > t0
u(0) = η

The Fundamental Theorem of Calculus implies that the IVP is


equivalent to the integral equation:
Z t
u(t) = η + f (u(s), s) ds
t0

How are we going to prove the existence of such function if we


can not determine a formula to calculate the integral?
Existence

Nonlinear case
The idea is to construct a sequence of “approximate” solutions
and then if we can show that this sequence (or a subsequence)
converges to something, that limit might be an exact solution.
For more details, see [1] or [2].
Uniqueness
To garantee that there is a unique solution, it is necessary to
require a certain amount of smoothness for f (u, t). For that
we need to define Lipschitz continuity.

Lipschitz continuity
The function f (u(t), t) is Lipschitz continuous in u over a
domain

D = {(u, t) : |u − η| ≤ a, t0 ≤ t ≤ t1 }

if there exists some constant L ≥ 0 so that

|f (u, t) − f (u∗, t)| ≤ L|u − u ∗ | , ∀(u, t) and (u∗, t) ∈ D


Uniqueness
Lipschitz continuity
The Lipschitz continuity is slightly stronger than mere
continuity, which only requires that |f (u, t) − f (u∗, t)| −→ 0
as u −→ u∗. The Lipschitz continuity requires that
|f (u, t) − f (u∗, t)| −→ o(|u − u ∗ |) as u −→ u∗.

If f (u, t) is differentiable with respect to u in D and the


derivative fu = ∂f /∂u is bounded, then we can take

L = max |fu (u, t)|


(u,t)∈D

since f (u, t) = f (u∗, t) + fu (v , t)(u − u∗) for some value v


between u and u∗.
Existence and Uniqueness

Theorem
If f is Lipschitz continuous over soma region D, then there is
a unique solution to the IVP at least up to the time

T ∗ = min(t1 , t0 + a/S) , where,


S = max |f (u, t)|
(u,t)∈D

Note that this is the maximum modulus of the slope that the
solution u(t) can attain in this time interval, so that it remains
in the domain D where the Lipschitz continuity holds.
Lipschitz continuity
Example 1:
Consider the IVP
(
u 0 (t) = (u(t))2 , t ∈ (t0 , t]
u(0) = η > 0

∂f
f (u, t) = u 2 , ∂u
= 2u

L = max |2u| = 2(a + η)


(u,t)∈D

because

|u − η| ≤ a ⇐⇒ −a + η ≤ u ≤ a + η

So f is Lipschitz continuous.
Lipschitz continuity

Example 2:
Consider the IVP
( p
u 0 (t) = u(t) , t ∈ (t0 , t]
u(0) = η > 0
√ ∂f 1
f (u, t) = u, ∂u
= √
2 u
−→ ∞ as u −→ 0.
So f is not Lipschitz continuous.
Numerical Methods for IVP’s

Consider the IVP


(
u 0 (t) = f (u(t), t) , t > t0
u(t0 ) = η

For simplicity we are going to use t0 = 0, k to denote the time


steps, so tn = t0 + nk for n ≥ 0.

Given an initial data U 0 = η,we want to compute


approximations U 1 , U 2 , . . . satisfying

U n ≈ u(tn )
Numerical Methods for IVP’s

Euler’s Method (forward Euler)

U n+1 − U n
= f (U n ) , n = 0, 1, 2, ...
k
or, U n+1 = U n + kf (U n )
Numerical Methods for IVP’s
Backward Euler

U n+1 − U n
= f (U n+1 ) , n = 0, 1, 2, ...
k
or, U n+1 = U n + kf (U n+1 )
This is an equation that must be solved for U n+1 and in
general f is a nonlinear function.
It is possible to use Newton’s Method to find the zero of the
function g given by

g (u) = u − kf (u) − U n

and then we have U n+1 .


Numerical Methods for IVP’s

Trapezoidal Method (or Crank-Nicolson):

U n+1 − U n 1
= [f (U n+1 ) + f (U n )] , n = 0, 1, 2, ...
k 2
or, U n+1 = U n + k2 [f (U n+1 ) + f (U n )]
This is also an implicit method and we must solve for U n+1 .
Multistep Methods

The preview methods are all one-step methods, meaning that


U n+1 is determined only from U n alone and previous values of
U are not needed.

One way to get higher order of accurancy is to use a


multistep method that involves other previous values.
Multistep Methods

Leapfrog method

U n+1 − U n−1
= f (U n )
2k
or, U n+1 = U n−1 + 2kf (U n ).

Backward Differentiation Formula (BDF)

3U n+1 − 4U n + U n−1
= f (U n+1 )
2k
Multistep Methods

Runge-Kutta
A two-stage Runge-Kutta method is given by:
1
U∗ = U n + kf (U n )
2
U n+1 = U n + kf (U∗)

Combining the two steps above, we can rewrite it as:

U n+1 = U n + kf (U n + kf (U∗))
Local Truncation Errors (LTE)

The Local Error Truncation is defined by replacing U n with the


true solution u(tn ) in the numerical method.
In general the true solution won’t satisfy this equation exactly
and the discrepancy is the LTE, that will be denoted by τn .
Local Truncation Errors (LTE)
Forward Euler

u(tn+1 ) − u(tn )
τn = − f (u(tn ))
k
We write u(tn+1 ) using Taylor polynomial around tn :

k 2 00
u(tn+1 ) = u(tn ) + ku 0 (tn ) + u (tn ) + o(k 3 )
2
k
τn = u 0 (tn ) + u 00 (tn ) + o(k 2 ) f (u(tn ))
2 | {z }
=u 0 (tn )

τn = ku 00 (tn ) + o(k 2 ) ⇒ so the method is 1st order accurate.


Local Truncation Errors (LTE)

Backward Euler

u(tn+1 ) − u(tn )
τn = − f (u(tn+1 ))
k
We write u(tn ) using Taylor polynomial around tn+1 :

k 2 00
u(tn ) = u(tn+1 ) + ku 0 (tn+1 ) + u (tn+1 ) + o(k 3 )
2

τn = ku 00 (tn+1 ) + o(k 2 ) ⇒ so the method is 1st order accurate.


Convergence

We consider an arbitrary but fixed time T > 0 and


consider the error on the approximation to u(T )
computed with a numerical method using time step k;
The method converges on this problem if the (global)
error goes to zero as k −→ 0;
Note that the time steps that we need to take to reach
time T increases as k −→ 0;
If we use N to denote this value (N = T /k), then
convergence means that

lim U N = u(T ) (*)


k−→0
Convergence

In principle a method might converge on one problem but


not on another, or converge only with one set of starting
values;
To speak of a method being convergent in general, we
require that it converges on all problems with all
reasonable starting values;
So the weakest condition we might put on our starting
values is that they converge to the correct initial value η
as k −→ 0:

lim U(k) = η (**)


k−→0
Convergence

Definition (convergence):
A IVP numerical method is said to be convergent if applying
the method to any ODE with f (u, t) Lipschitz continuous in
u, and with any set of starting values satisfying (**), we
obtain convergence in the sense of (*) for every fixed time
T > 0 at which the ODE has a unique solution.
Global Error (GE)
Example: Euler’s method on linear problems
Consider the IVP u 0 (t) = λu(t) + g (t) with u(t0 ) = η.
If we apply the forward Euler method to it,

U n+1 = U n + k(λU n + g (tn ))


= (1 + λk)U n + kg (tn )

The LTE for Euler’s method is


k 00
τn = u (tn ) + o(k 2 )
2
We can write for the exact solution:

u(tn+1 ) = (1 + λk)u(tn ) + kg (tn ) + kτn


Global Error (GE)

Example: Euler’s method on linear problems


The Global Error is defined as the difference between the true
solution and the approximation using the numerical method,
that is, E n = U n − u(tn ).

For the Euler’s method applied to the linear IVP we get the
difference equation:

E n+1 = (1 + λk)E n − kτn


Convergence
Example: Euler’s method on linear problems
Say that the Euler’s method converges on the IVP means that
the global error goes to zero as k −→ 0.
Observe that |1 + kλ| ≤ e k|λ| , and so
(1 + kλ)n−m ≤ e (n−m)k|λ| ≤ e nk|λ| ≤ e |λ|T
because nk ≤ T .
It follows that
 n
X 
|E n | ≤ e |λ|T |E 0 | + k |τm−1 |
m=1
 
n |λ|T 0
|E | ≤ e |E | + k max |τm−1 |
1≤m≤n
Convergence
Let N = T /k be the number of steps needed to reach the
time T and set
k 00
kτ k∞ = max |τn | ≈ ku k∞ = o(k)
0≤n≤N−1 2
Then for t = nk ≤ T , we have

|E n | ≤ e |λ|T (|E 0 + T kτ k∞ )

If (**) is satisfied then E 0 −→ 0 as k −→ 0. In fact, we could


just take U 0 = u(0) = η. Thus,

|E n | ≤ e |λ|T T kτ k∞ = o(k) as k −→ 0

and hence the method converges and is in fact 1st order.


References

1. Leveque, R. J. Finite Difference Methods for Ordinary


and Partial Differential Equations. SIAM, 2007.

2. Boyce, W.E., DiPrima, R.C. Elementary Differential


Equations and Boundary Value Problems. John Wiley &
Sons,10th ed., 2012.

You might also like