Euler Method - Using the Method with Mathematica - Part 6
Numerical Methods for Solving Differential Equations
Euler's Method
Using the Method with Mathematica
(continued from last page...)
I've abbreviated the output a little here, in order to save space. You should have gotten the long version of:
prelimsol3=euler[x+2y, {x, 0, 1}, {y, 0}, 100]
{{0, 0}, {0.01, 0}, {0.02, 0.0001}, {0.03, 0.000302},
{0.04, 0.00060804}, {0.05, 0.0010202}, {0.06, 0.0015406},
.
.
.
{0.95, 0.915425}, {0.96, 0.943233}, {0.97, 0.971698},
{0.98, 1.00083}, {0.99, 1.03065}, {1., 1.06116}}
MatrixForm[prelimsol3]
0 0
0.01 0
0.02 0.0001
0.03 0.000302
. .
. .
. .
0.98 1.00083
0.99 1.03065
1. 1.06116
So, our new last point is (1.00, 1.06116), which is much closer to the correct result of (1.00, 1.097264), but is still not perfect. Clearly if we wanted even greater accuracy, we could ask the computer for even more steps—if we were willing to wait for the calculations to finish. I don't think we'll bother, however.
Let's go and have you try some exercises on your own instead...