Numerical solution of Differential Equation¶
Reference
微分方程数值解:有限差分理论方法与数值计算, 张文生
微分方程数值解, 陈文斌
In ordinary differential equation
in region \([a,b]\). Note that it is hard to know the function, but we know its derivatives at all points on the region. That is, for any dicrete point \(t_n\in [a,b]\), we have
The following part is focused on using there infomation to get a solution of ODE.
数值微分 | Numerical Differentiation¶
Denote \(h\) as the time step forward, then according to Taylor expansion evaluated at \(t_n\) and take another forward point \(t_{n+1}\)
backward at point \(t_{n-1}\), we substitute \(h\) with \(-h\) and get
So we have an approximation of the first order derivative from equation \(\ref{forward}\), that is, the forward form of divided difference
or from equation \(\ref{backward}\), that is, the backward form of divided difference
Combine equation \(\ref{Forward}\) and equation \(\ref{Backward}\) we have the center divided difference form
which is more accurate. Now we can use the above equation to get Euler' method.
Three Point Midpoint Formula
Use Lagrange Polynomial to approximate a function. Then the \(n\)th derivative of Lagrange Poly approximate the \(n\)th derivative of the original function.
Euler's Method¶
Here we introduce Euler's one step method
From forward form of divided difference \(\ref{Forward}\) we have its rounding error
First analyze its convergence.
Convergence of Euler's Method
Assume solution \(\phi(t)\in C^2[t_0,b]\), then the error of the solution \(w_n\) acquired from Euler's method satisfies
where
If \(h\rightarrow 0\), s.t.
then \(\exists c>0\), such that
Then we analyze its asymptotic stability.
Definition of asymptotic stability
We call Euler's one step method is asymptotic stable, if \(\exists h_0>0\), \(\exists C>0\), such that \(\forall h\in (0,h_0]\),
where \(w_n\) and \(z_n\) denotes the solution from before disturbance(initial value \(w_0\)) and after disturbance(initial value \(z_0\)) using Euler's one step method.
The above shows that Euler's method is asymptotic stable.
Implicite Euler's method¶
Implicite means we have to guess the number before iterating. Usually it is used after Explicite Euler's method to improve stability.
From Backward form of Numerical Derivative(Divided Difference) \(\ref{Backward}\), we can express its rounding error
Modified Euler's Method¶
So we can choose higher order items to improve accuracy.
This method is also called Tranpezoid Method.
We have this inspiration from tranpezoidal integration.
From integration the ODE on \([t_n, t_{n+1}]\) we have
Using Tranpezoidal Integration Formula with its Error, we have
which means a higher accuracy for method
Double-step Method¶
We have this method inspired by the center form of divided difference.
According to center form of divided difference \(\ref{center}\) we have
with its rounding error expressed by
Taylor method of order n¶
To improve precision, we can choose more items of Taylor's expansion for the one order derivative.
where
Euler's method is Tarlor's method of order one.
Runge-Kutta Method¶
For Taylor's method of higher order, it is trivial to calculate high order derivatives, especially when \(p>3\) and \(f\) has a complex expression. So the following Runge-Kutta Method aims to calculate function \(f\)'s values at different points to avoid high order derivatives, reducing calculation time.
- Runge-Kutta method with order 4.
Multistep Methods¶
Derive from integration
use interpolation polynomial to replace f(t,y).
- Adams-Bashforth Four-step Explicit Method
- Adams-Bashforth Three-step Implicit Method
Or we derive from Taylar expansion.