"); hg.document.close(); } function ptip(){ hg=window.open('','','toolbar=no,width=400,height=100,top=0,left=0'); hg.document.open(); hg.document.writeln(""); hg.document.writeln("Positive definite"); hg.document.close(); } function sclose(){ hg.window.close(); }  
Example 2:
Using Taylor series method of order four solve the initial value problem y' = (x - y)/2, on [0, 3] with y(0) = 1.  Compare solutions for h = 1, 1/2, 1/4 and 1/8.

Solution:
Given y' = f(x,y) = (x - y)/2

Þ y''   = (1 - y')/2,               y''' = -y''/2,             yiv  = -y'''/2

The forth order Taylor's formula is

y(xi+h) = y(xi) + h y'(xi, yi) + h y''(xi, yi)/2! + h3 y'''(xi, yi)/3! + h4 yiv(xi, yi)/4! + . . .

           = 1 + h (xi - yi)/2 - h (1 - y'i)/(2*2!) - h3 y''i/(2*3!) - h4 y'''i/(2*4!) +  o(h5)

           = .5* ( 2 + h (xi - yi) - .5h (1 - y'i) - .1667h3 y''i - .0417h4 y'''i ) +  o(h5)
 
 

Comparison of the solution for various h
xi
yi
Exact 
yi
h = 1
 h = .5
 h = .25
 h = .125
0.000
0.125
0.250
0.375
0.500
0.750
1.000
1.500
2.000
2.500
3.000
1.000000
 
 
 
 

0.820315

1.104513

1.670186

1.000000
 
 

0.836426

0.819629
0.917142
1.103683
1.359558
1.669431

1.000000

0.897492

0.836404
0.811870
0.819594
0.917102
1.103641
1.359517
1.669393

1.000000
0.943239
0.897491
0.862087
0.836402
0.811868
0.819592
0.917100
1.103639
1.359515
1.669391
1.000000
0.943240
0.897492
0.862087
0.836402
0.811868
0.819592
0.917100
1.103639
1.359514
1.669391