FORWARD EULER'S METHOD (TI-83)
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.
- :{0}=>L1
- :L1=>L2
- :Input "X0?", A
- :Input "Y0?", B
- :Input "DX?", D
- :Input "NUMBER OF STEPS?", N
- :A=>L1(1)
- :B=>L2(1)
- :For(I,1,N,1)
- :A+D*I=>L1(I+1)
- :L2(I)+D*Y1(L1(I))=>L2(I+1)
- :End
- :PlotsOff
- :FnOff
- :FnOn 2
- :Plot1(Scatter,L1,L2,W)
- :ZoomStat
- :0=>Ymin
- :Equ>String(Y2, Str1)
- :Text(1,20, "Y=, Str1)
- :Pause
- :ClrDraw
- :abs((Y2(L1)-L2)/Y2(L1))=>L3
- :ZoomStat
- :0]Ymin
- :Text(1, 25, "RELATIVE ERROR")
- :Text(10, 9, MAX ERROR=", round(max(L3), 5))
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.