Math 2250 - 002 Euler's Method in Maple

advertisement
Math 2250 - 002
Euler's Method in Maple
This file shows how to use Euler's method to approximate the solution to an IVP. Here we will
approximate the solution the the following IVP:
y' = 2y ,
y(0) = 1
We will approximate the solution at x = 1 using step-size h = 0.1
You will need to make several modifications to this code in order to correctly answer the questions in
the project. See the Maple Help file or the Maple Commands file for further assistance.
(1)
(2)
Now that we have created all of the appropriate definitions above, use a for-loop to run the iterative
Euler Algorithm.
The value of y(1) should be stored in the very last y-value that was calculated in the above for-loop.
That y-value is stored in y[N]. We simply display this calculated y-value in the following command.
6.191736422
(3)
The actual solution to this problem is known to be y(x) = exp(2x). For this problem it is possible to
calculate the actual solution and compare it to the numerical solution. The difference between the
actual solution and the numerical solution is known as the error.
To reduce the error in your numerical calculation, you can either decrease the step-size, h, or you can
use a better algorithm. Below we have defined E to be the absolute error. We define s(x) to be our
exact solution since the variable y is already taken.
(4)
(5)
Download