FORWARD EULER'S METHOD (TI-92)

The first thing that we must do is to select an equation that we want to investigate. Let us start with the exponential function. For Y1, store "Y1=exp^(X). Turn the plotting option off of Y1. Input Y2 as the anti-derivative. Clear all the other Y function variables. Remember that this is the derivative of the function that we are trying to find.

Let d=dx and n=number of time steps.

:euler()
:Prgm"euler".
:setMode("Exa/Approx","AUTO")
:DelVar l1, l2, l3
:{0}=>l1
:l1=>l2
:Input "xo", a
:Input "yo", b
:Input "dx", d
:Input "number of steps",n
:a=>l1[1]
:b=>l2[1]
:For i, 1, n
:a+d*i=>l1[i+1]
:l2[i]+d*y1(l1[i])=>l2[i+1]
:EndFor
:PlotsOff
:FnOff
:FnOn 2
:NewPlot 1, 1, l1, l2, , , , 5
:ZoomData
:0=>ymin
:PxlText "y=", 1, 85
:PxlText string(y2(x)), 1, 97
:Pause
:ClrDraw
:abs((y2(l1)-l2)/(y2(l1)))=>l3
:FnOff
:NewPlot 1, 1, l1, l3, , , , 5
:ZoomData
:0=>ymin
:PxlText "Relative Error", 1, 80
:PxlText "Max Error=", 10, 25
:PxlText string(round(max(l3),5)), 10, 85
:EndPrgm
Discussion:
Play with the program. Start with "reasonable" dx, and then let dx get "large".
Why is the nice selection of X0 and Y0 important?
Change Y1 to Y1=2X.
What are initial value problems? How do these affect Y2?

Assignments:
What is Backward Euler's Method? Program it.
Make a graph of the relative error for one initial value problem. Program it.