Professional Documents
Culture Documents
Ahmed Al-Jamel
The ODE:
First we need to approximate the second derivative in (1) using one of the following formulas:
1. Forward di¤ erence approximation,
where the error term is roughly of order h2 , or baybe better. Here the weights are given by
8
< ( 1)i (i 1)1 + i1 ; if k = 0;
n 1
wi;k := 2(i k) (i k 1)1 (i k + 1)1 ; if k = 1; :::; i 1;
(2 ):
1; if k = i:
Approximation Method
For an integer n > 2, we seek approximations to the exact solution y at a given set of points (called
mesh points) xi 2 (a; d), i = 1; :::; n 1. In this method, we will consider equidistance mesh points. Set
h = (d a)=n, then xi = x0 + ih, with x0 = a. Consequently, xi + jh = xi+j , j is a negative or positive
integer. Next we need the ODE (1) to be satis…ed at the mesh points xi , i.e.:
For notations, let yi := y(xi ), bi := b(xi ), bi := b(xi ), and fi := f (xi ), then using the recipes (4) and (6), we
get
i
X
1 2
(y i+1 2y i + y i 1 ) + O(h ) + b i wi;k yk + O(h2 q ) + ci yi = fi :
h2
k=0
Let y~i be the approximations to yi , i.e. yi y~i , we get (after ignoring the error terms above)
i
X
1
(~
yi+1 2~
yi + y~i 1 ) + bi wi;k y~k + ci y~i = fi :
h2
k=0
1
Re-arranging the terms to get (just a simple algebra, I don’t have time to show all details)
i
X
y~i+1 = h2 fi + w
~i;k y~k ; i = 1; :::; n 1: (7)
k=0
Notice that (7) de…nes a recurrence relation which needs two initial values, y~0 , and y~1 . But y~0 = y0 = y(a),
so what is needed is to approximate y~1 . From the de…nition of derivative, we have
y1 y0
A := y 0 (a) ;
h
and so (roughly speaking, take) y~1 = Ah + y0 .
Some remarks: Later...
Computer implementation: use your convinient CAS (Computer Algebra System). See the attached Mathe-
matica notebooks for examples and implementations.