Well, in class today we got this program for Eulers law.
At the end of the program it displays the error between it and the actual graph. This part of the program is actually broken.
The whole problem is that this part of the program doesnt seem to be in the code. I can figure it out for the life of me.
Code: For the delta sign I changed it to ▲ and the store sign to >
▲X>J
Prompt X,Y,▲X,N
Input "F(X,Y)=?",Str1
String>Equ(Str1,r1)
For(I,1,N
Y+▲X*r1>Y:X+▲X>X
Disp ""
int(log(I))>A
Output(7,1,I
Output(7,A+2,":"
Output(7,3+A,X
Output(7,10," "
Output(7,11,Y
Output(8,1," "
If (I/5)=int(I/5)
Pause
End
J>▲X
:ΔX→J
:Prompt X,Y,ΔX,N
:Input "F(X,Y)=?",Str1
:Str1→r1
:For(I,1,N
:Y+ΔX*r1→Y
:X+ΔX→X
:Disp "
:int(log(I→A
:Output(7,1,I
:Output(7,A+2,":
:Output(7,3+A,X
:Output(7,10,"
:Output(7,11,Y
:Output(8,1,"
:If not(fpart(N/5
:Pause
:End
:J→ΔX
Optimized and formated the code.
Now to the question are you getting a syntax error or something different I don't have my calc with me so I can't test it.
The first and last lines in the program are there to preserve ΔX so that it doesn't leave the user's window with a different aspect ratio than before he ran the program, and as far as I can tell, it's not meant to display any error relevant to the function of the program. What that number equals is the horizontal distance (in points) between two adjacent pixels on the graph screen, given the user's window settings. If you want to keep it from displaying, use Stop—[PRGM] [ALPHA] [COS] in the editor—as the last line of the program.
Pretty much, it is displaying the evaluation of J→ΔX, and putting the Stop will make it not display.
Timothy Foster  @tfAuroratide
Auroratide.com  Go here if you're nerdy like me
BTW as an example of the output
With:
x = 0
y = 3
▲x = .25
N = 4
F(X,Y) (also known as r1) = Y1
I get:
Notice the last line that is supposed to be the error estimate. An accurate estimate would be close to 0.554. I dont even know where that line of text is coming from. If someone could identify where it comes from that would help a lot.
Thanks






Ya I feel so dumb now. I forgot that the last line displays like a regular command. The whole part about the person adding in an error check feature was bogus.
Thanks for the optimized code.
In any case, I would have done a certain portion of the program like so:
:ΔX→J
:Prompt X,Y,ΔX,N
:Input "F(X,Y)=?",Str1
:For(I,1,N
:Y+ΔXexpr(Str1)→Y
...
:)
I will also note that there is no way to get a usable error estimate out of a vanilla Euler method program, unless you know beforehand the function that is supposed to be the solution to your differential equation.
Otherwise, there is an algorithm that allows you an estimate of the error. The basic recipe is to do one full Euler step and two Euler half steps, and use Richardson extrapolation for the error estimate of the "full step". Of course the code for this will no longer be as simple.
thornahawk