Question: display value of integrer when stop test is verified

Dear all

 

I want to display the value of k   for which the stop test is verified. Thanks for your help. 



epsilon:=(y0,N)->evalf(abs(

RK3(f,0,1,y0,N)[N+1][2] -eval(analyticsol,x=1)) );
> f := (x, y) -> -y
> y0 = 1;
                         
> data[RK3] := [seq([N, epsilon(y0, N)], N = 2 .. 150, 2)];

 testerror:=array(1..75);
for k from 2 by 2 to 50 do
testerror[k]:=data[RK3][k][2];
if testerror[k]<=0.0001 then break; end if; end do;

Please Wait...