Question: Error betwenn exact and approximate solution of ode. How compute

March 21 2014 sarra 215



I have a procedure which give an approximate solution for ode.

This our procedure

RKadaptivestepsize := proc (f, a, b, epsilon, N).

It's working ( afther some 3 mistake found by a member in Mapleprime).

Then I would like to compute the error between exact and approximate.

RKadaptivestepsize: compute the approximate solution

analyticsol: analytic solution


## here, I compute the error
for N from 2 by 2 to 500 do
dataerror:= N->evalf(abs(RKadaptivestepsize(f,0,1,epsilon,N)[1+N][2]-(eval(analyticsol, x = 1))));
##  sequence of data error
data[error] := [seq([N, dataerror(N)], N = 2 .. 500, 2)]:
if  data[error][k][2]<=epsilon then   
printf("%a  is the number of steps required using 3-step Runge Kutta Method to achieve an  eroor of 1e-6 .", k)
break ;
end if;   
end do;
end do;

But its gives an error.: Error, reserved word `error` unexpected

Have any one an idea.


Please Wait...