next up previous
Next: About this document ...

ESC 251 HW 34 Due: Dec. 1

Recall that Euler's Method for solving a first order initial value problem is given by

     y(0) = yO
     y(i+1) = y(i) + h*f(t(i),y(i)),  i = 0,1,.....

Write a main program and accompanying subroutines/functions that will implement Euler's Method for solving the first order initial value problem

\begin{displaymath}y'(t) = f(t,y(t)),\quad y(0) = y_0,\quad\mbox{on}\quad t \in [0,b].\end{displaymath}

At a minimum, you will need a subroutine for implementing the main Euler's Method loop and a function to evaluate f(t,y(t)).
You will need to input a value of n and define

\begin{displaymath}h = \frac{b-a}{n}\end{displaymath}

as we have been doing.
Your main program should compute the exact solution, the error vector $y_{\mbox{exact}}-y_{\mbox{computed}}$ and the 2-norm of this error vector (the subroutine you wrote in HW 24 will be useful here).
One tricky aspect of the problem is that in the Euler's Method pseudocode above, the subscripts on the variables start with index 0. Fortran subscripts start with index 1, so you will need to account for this.

Use your program to compute an approximate solution to the problem

\begin{displaymath}y' = -ty,\quad y(0) = 2,\quad\mbox{on}\quad t \in [0,4].\end{displaymath}

Use separation of variables to compute the exact solution. How large must n be in order to guarantee that the 2-norm of the error vector is less than 10-6?

NOTE: This is an evaluation assignment. It is essentially an informal take-home test where you can ask questions. However, you are limited to a maximum of 5 emails per day (5 today and 5 on Thursday). I will be in the office on Thursday from 11:45 - 12:45 and 3:15 to 5:30. I will not be in my office on Friday morning.

next up previous
Next: About this document ...