Euler's Method Math 2280-002, Spring 2013

```Math 2280-002, Spring 2013
Euler's Method
The goal of this worksheet is to demonstate how MAPLE can be used to implement
Euler's method. In particular, we'll consider the IVP
,
We can solve this initial value problem explicitly by hand using integrating factors,
but that would be tedious since we would have to integrate by parts multiple times.
Instead, let's have MAPLE do the work for us.
&gt;
(1)
&gt;
That means our IVP has the particular solution
Now let's use Euler's method to approximate this solution and then check how close
our approximation is.
Euler's method on the interval [a,b] for the IVP
,
with step size
is as follows. The step size is
The algorithm is
where
&gt;
&gt;
&gt;
is the slope of the tangent line at
&gt;
Now that we have initialized these variables, use a for-loop to run the Euler
algorithm.
&gt;
x1=1.1 y1=1.2
x2=1.2 y2=1.46641
x3=1.3 y3=1.82041
x4=1.4 y4=2.28806
x5=1.5 y5=2.90103
x6=1.6 y6=3.69738
x7=1.7 y7=4.72248
x8=1.8 y8=6.02994
x9=1.9 y9=7.68269
x10=2 y10=9.75417
&gt;
Graph the solution and the approximation.
&gt;
&gt;
&gt;
10
8
6
4
2
1
2
x
Let's compare the value we get from Euler's method with the actual value of the
solution at
.
&gt;
(2)
&gt;
(3)
&gt;
(4)
&gt;
(5)
&gt;
As you can see, this isn't a particularly good approximation even when N=10.
How can you modify the code above for the improved Euler's method? What about for
Runge-Kutta?
```