Next: 4. Predictor - Corrector Up: Main Previous: 3.3 Algorithm (Runge-Kutta) method

Example

Use the Runge-Kutta method of order 4 to find the approximate solution of the IVP.

$\displaystyle y'=y^2,\,\,\,y(0)=1, \,\,\,0<x<.5$

with the step size (1) 0.1, (2) 0.05 and (3) 0.025. Calculate the error and tabulate the results.
Solution: It is an exercise. See the tables 7,8 and 9.

Table 7
Initial x
Initial y
Stepsize h
Appx. Y
Exa. Y
Error
k1
k2
k3
k4
0.000000000
1.000000000
0.100000000
1.000000000
1.000000000
0.000000000
0.100000000
0.110250000
0.111328877
0.123505187
0.100000000
1.000000000
0.100000000
1.111110490
1.111111111
0.000000621
0.100000000
0.146678862
0.140292162
1.566008596
0.200000000
1.111110490
0.100000000
1.234449921
1.250000000
0.015550079
0.123456652
0.184391026
0.175998811
2.210405014
0.300000000
1.234449921
0.100000000
1.388373760
1.428571429
0.040197668
0.152386661
0.237394267
0.227126268
3.221717202
0.400000000
1.388373760
0.100000000
1.583264224
1.666666667
0.083402442
0.192758170
0.315425554
0.303100092
4.940348000
0.500000000
1.583264224
0.100000000
1.837356086
2.000000000
0.162643914
0.250672560
0.006283673
0.338743260
7.497402655
Table 8
Initial x
Initial y
Stepsize h
Appx. Y
Exa. Y
Error
k1
k2
k3
k4
0.000000000
1.000000000
0.050000000
1.000000000
1.000000000
0.000000000
0.050000000
0.052531250
0.052661057
0.055404765
0.050000000
1.000000000
0.050000000
1.052631563
1.052631579
0.000000016
0.050000000
0.060789818
0.058647317
1.234940749
0.100000000
1.052631563
0.050000000
1.108026472
1.111111111
0.003084639
0.055401660
0.067678251
0.065192852
1.448887960
0.150000000
1.108026472
0.050000000
1.169566428
1.176470588
0.006904160
0.061386133
0.075762210
0.072896477
1.710476056
0.200000000
1.169566428
0.050000000
1.238140600
1.250000000
0.011859400
0.068394281
0.085351670
0.082024537
2.038362460
0.250000000
1.238140600
0.050000000
1.315013575
1.333333333
0.018319758
0.076649607
0.096836321
0.092947305
2.454432772
0.300000000
1.315013575
0.050000000
1.401756539
1.428571429
0.026814889
0.086463035
0.110739875
0.106160878
2.990097511
0.350000000
1.401756539
0.050000000
1.500357994
1.538461538
0.038103544
0.098246070
0.127776748
0.122343335
3.691048693
0.400000000
1.500357994
0.050000000
1.613369403
1.666666667
0.053297264
0.112553706
0.148940529
0.142440137
4.625404360
0.450000000
1.613369403
0.050000000
1.744116520
1.818181818
0.074065298
0.130148042
0.175643382
0.167799881
5.897549758
0.500000000
1.744116520
0.050000000
1.897012232
2.000000000
0.102987768
0.152097122
0.001156677
0.180042499
7.524391368
Table 9  
Initial x
Initial y
Stepsize h
Appx. Y
Exa. Y
Error
k1
k2
k3
k4
0.000000000
1.000000000
0.025000000
1.000000000
1.000000000
0.000000000
0.025000000
0.025628906
0.025644828
0.026298683
0.025000000
1.000000000
0.025000000
1.025641025
1.025641026
0.000000000
0.025000000
0.026943420
0.026993882
0.027701006
0.050000000
1.025641025
0.025000000
1.052403627
1.052631579
0.000227952
0.026298488
0.028385073
0.028440684
0.029205611
0.075000000
1.052403627
0.025000000
1.080596229
1.081081081
0.000484852
0.027688835
0.029945008
0.030006771
0.030835976
0.100000000
1.080596229
0.025000000
1.110334291
1.111111111
0.000776821
0.029192205
0.031636710
0.031705495
0.032606372
0.125000000
1.110334291
0.025000000
1.141748121
1.142857143
0.001109021
0.030821056
0.033475403
0.033552235
0.034533273
0.150000000
1.141748121
0.025000000
1.174983056
1.176470588
0.001487532
0.032589719
0.035478577
0.035564665
0.036635645
0.175000000
1.174983056
0.025000000
1.210201697
1.212121212
0.001919515
0.034514630
0.037666391
0.037763169
0.038935408
0.200000000
1.210201697
0.025000000
1.247586556
1.250000000
0.002413444
0.036614704
0.040062185
0.040171363
0.041458011
0.225000000
1.247586556
0.025000000
1.287343191
1.290322581
0.002979389
0.038911805
0.042693097
0.042816721
0.044233135
0.250000000
1.287343191
0.025000000
1.329703954
1.333333333
0.003629379
0.041431312
0.045590828
0.045731364
0.047295558
0.275000000
1.329703954
0.025000000
1.374932496
1.379310345
0.004377849
0.044202815
0.048792593
0.048953027
0.050686250
0.300000000
1.374932496
0.025000000
1.423329214
1.428571429
0.005242215
0.047260984
0.052342310
0.052526283
0.054453736
0.325000000
1.423329214
0.025000000
1.475237865
1.481481481
0.006243617
0.050646651
0.056292097
0.056504080
0.058655835
0.350000000
1.475237865
0.025000000
1.531053671
1.538461538
0.007407867
0.054408169
0.060704181
0.060949699
0.063361868
0.375000000
1.531053671
0.025000000
1.591233304
1.600000000
0.008766696
0.058603134
0.065653332
0.065939270
0.068655523
0.400000000
1.591233304
0.025000000
1.656307281
1.666666667
0.010359386
0.063300586
0.071230019
0.071565026
0.074638568
0.425000000
1.656307281
0.025000000
1.726895488
1.739130435
0.012234947
0.068583845
0.077544527
0.077939565
0.081435739
0.450000000
1.726895488
0.025000000
1.803726783
1.818181818
0.014455035
0.074554201
0.084732382
0.085201482
0.089201250
0.475000000
1.803726783
0.025000000
1.887663979
1.904761905
0.017097926
0.081335758
0.092961594
0.093522900
0.098127536
0.500000000
1.887663979
0.025000000
1.979736026
2.000000000
0.020263974
0.089081882
0.000049597
0.097986323
0.107923254

 


Next: 4. Predictor-Corrector Up: Main Previous: 3.3 Algorithm (Runge-Kutta) method