Mathematical Tools for Physics

(coco) #1
11—Numerical Analysis 334

Example: Solvey′=y y(0) = 1 (h= 0.1)
I could use Runge-Kutta to start and then switch to Adams as soon as possible. For the purpose of this example,
I’ll just take the exact value ofyatx= 0. 1.


e.^1 = 1. 105170918
y(.2) =− 4 y(.1) + 5y(0) +. 1

[


4 f

(


. 1 ,y(.1)


)


+ 2f

(


0 ,y(0)

)]


=− 4 y(.1) + 5y(0) +. 4 y(.1) +. 2 y(0)
=− 3. 6 y(.1) + 5. 2 y(0)
= 1. 221384695

The exact value ise.^2 = 1. 221402758 ; the first error is in the underlined term. Continuing the calculation to
higher values of x,
x y
.3 1.34990 38
.4 1.4915 47
.5 1.6489 31
.6 1.819 88
.7 2.02 28
.8 2.18 12
.9 2.6 66
1.0 1 .74
1.1 7.59
1.2 −18.26
1.3 105.22 0. .5 1.
Everything is going very smoothly for a while, though the error is creeping up. At aroundx= 1, the
numerical solution goes into wild oscillation and is completely unstable. The reason for this is in the coefficients
− 4 and+5ofy(−h)andy(− 2 h). Small errors are magnified by these large factors. (The coefficients ofy′are
not any trouble because of the factorhin front.)


Instability
You can compute the growth of this error explicitly in this simple example. The equation ( 42 ) together with

Free download pdf