I have this code for Runge-Kutta-Fehlberg Method
while flag = 1 do
k1 := h*f(t, w);
k2 := h*f(t+(1/4)*h, w+(1/4)*k1);
k3 := h*f(t+(3/8)*h, w+(3/32)*k1+(9/32)*k2);
k4 := h*f(t+(12/13)*h, w+(1932/2197)*k1-(7200/2197)*k2+(7296/2197)*k3);
k5 := h*f(t+h, w+(439/216)*k1-8*k2+(3680/513)*k3-(845/4104)*k4);
k6 := h*f(t+(1/2)*h, w-(8/27)*k1+2*k2-(3544/2565)*k3+(1859/4104)*k4-(11/40)*k5);
R := abs((1/360)*k1-(128/4275)*k3-(2197/75240)*k4+(1/50)*k5+(2/55)*k6)/h; if R <= Tol then
t := t+h;
w := w+(25/216)*k1+(1408/2565)*k3+(2197/4104)*k4-(1/5)*k5;
y := subs(T = t, exact(T)) end if;
printf(" %4.7f %4.7f %7.7f %7.7f\n", h, t, w, y);
q := .84*(Tol/R)^(1/4);
if q <= .1 then h := .1*h
elif q >= 4 then h := 4*h
else h := q*h end if;
if h > hmax then h := hmax end if;
if t >= b then flag := 0
elif t+h > b then h := b-t
elif h < hmin then flag := 0 end if
end do;
Now, I want to draw the values of y and w against t. I can't use seq plot because I don't have for loop. In Mathlab we usually open a file and then draw from the data. Here I couldn't do the same thing.
Maple creates a plot all at once, rather than building it incrementally. What you can do is build up the sequence of points, then plot it. Thus at the start:
Then when you have computed t,x,y:
and after the loop finishes, something like: