The same as Matt.
I had to help him with it too :P.
Euler's method says that, given a step size h, and a differential equation then the solution to a differential equation is given by:
So for you, your equations would be:
So your program should look something like this:
Of course, I'm fairly sure you guys use maple, whereas I am more conversant in MatLab, so I can't give the program to you in Maple!Code:set x(1) = 0 set y(1) = -1 set h = 0.01 for k = 2 to 501 in steps of 1 y(k) = y(k-1)+h*((y(k-1))^2-2*(x(k-1))*(y(k-1))+1+(x(k-1))^2); x(k) = x(k-1)+h; end plot(x,y)
However, in matlab, it looks like this:
If I'm talking out of context here, you may be better to talk to Matt. He uses this forum, goes by the name Mitch something! He'll know.Code:x(1) = 0; y(1) = -1; h= 0.01; for i = 2:1:501; y(i) = y(i-1)+h*((y(i-1))^2-2*(x(i-1))*(y(i-1))+1+(x(i-1))^2); x(i) = x(i-1)+h; end plot(x,y,'r')