Lab for Euler's Method

Module for Euler's Method

   Check out the new Numerical Analysis Projects page.

Purpose. Euler's method and the Modified Euler's method have accuracies of order O(h) and O([Graphics:eu.txtgr1.gif]).
Construct numerical solutions of of order O(h) and O([Graphics:eu.txtgr2.gif]), and attempt to estimate the accuracy of our computed solutions.

HINT. First get the subroutine Euler to work, then modify it in one line to obtain MEuler. Then you have two methods to solve I.V.P.'s.

Euler's Method for O.D.E.'s. To approximate the solution of the initial value problem [Graphics:eu.txtgr3.gif] over [a, b] by computing [Graphics:eu.txtgr4.gif].

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr5.gif]

Modified Euler's Method for O. D. E.'s. To approximate the solution of the initial value problem [Graphics:eu.txtgr7.gif] over [a, b] by computing
[Graphics:eu.txtgr8.gif].

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr9.gif]
 
 

Report to be handed in.

Computer Problems.



Exercise 1.
Solve the I.V.P. [Graphics:eu.txtgr10.gif] with y(0) = 1 over [0.0, 0.4].
Use Euler's method with 4 subintervals of [0.0, 0.4] to get a numerical approximation to the solution.
Show the calculations for each step.
Compare the Euler solution with the known analytic solution [Graphics:eu.txtgr11.gif].

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr12.gif]

Exercise 2. Solve the I.V.P. [Graphics:eu.txtgr13.gif] with y(0) = 1 over [0.0, 0.4].
Use the modified Euler's method with 4 subintervals to get a numerical approximation to the solution.
Show the calculations for each step.
Compare the Euler solution with the known analytic solution [Graphics:eu.txtgr14.gif].

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr15.gif]


Exercise 3.
Solve the Initial Value Problem
[Graphics:eu.txtgr16.gif]t <= 5.
Compute solutions based on 20 subintervals and plot the results.

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr17.gif]

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr18.gif][Graphics:eu.txtgr6.gif][Graphics:eu.txtgr19.gif][Graphics:eu.txtgr6.gif][Graphics:eu.txtgr20.gif]

Do an error analysis by looking at the difference between the two methods. Although the "true" solution is NOT known, this is one way to estimate the accuracy.

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr21.gif]

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr22.gif]

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr23.gif]

Exercise 4. Solve the Initial Value Problem
[Graphics:eu.txtgr24.gif]t <= 5.
Compute solutions based on 40 subintervals and plot the results.

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr25.gif]

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr26.gif][Graphics:eu.txtgr6.gif][Graphics:eu.txtgr27.gif][Graphics:eu.txtgr6.gif][Graphics:eu.txtgr28.gif]

Do an error analysis by looking at the difference between the two methods. Although the "true" solution is NOT known, this is one way to estimate the accuracy.

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr29.gif]

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr30.gif]

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr31.gif]

Exercise 5. Solve the Initial Value Problem
[Graphics:eu.txtgr32.gif]t <= 5.
Compute solutions based on 80 subintervals and plot the results.

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr33.gif]

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr34.gif][Graphics:eu.txtgr6.gif][Graphics:eu.txtgr35.gif][Graphics:eu.txtgr6.gif][Graphics:eu.txtgr36.gif]

Do an error analysis by looking at the difference between the two methods. Although the "true" solution is NOT known, this is one way to estimate the accuracy.

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr37.gif]

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr38.gif]

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr39.gif]

Exercise 6. Answer this question too!
How is the error decreasing in 3 - 5 ?
Read the book and explain why this is happening.
Is this what we expect with Euler's method which is a method of order O[h] ?
Give reference to an equation in the text regarding this behavior.

[Graphics:eu.txtgr6.gif][Graphics:eu.txtgr40.gif]
 
 

 

 

(c) John H. Mathews, 1998