# Illustration of use of dsolve/numeric with 'lsode' method.
# Thanks to David W. Neilsen for working out the template.

Digits := 20;
ErrorTol := 1e-10;

deq := diff(y(t),t) = y(t);
iv  := y(0) = 1;

C := array(1..30);
for i from 1 to 30 do C[i]:= 0; od;
C[1] := 0;
C[2] := ErrorTol;
C[10] := 1000;

S := dsolve({deq,iv},{y(t)},type=numeric,method=lsode[adamsfull],ctrl=C);

soln  := S(2.5);
val   := subs(soln[2],y(t));
error := val - exp(2.5);

# Same computation but carrying more digits and working to higher 
# tolerance

Digits := 40;
ErrorTol := 1e-20;

deq := diff(y(t),t) = y(t);
iv  := y(0) = 1;

C := array(1..30);
for i from 1 to 30 do C[i]:= 0; od;
C[1] := 0;
C[2] := ErrorTol;
C[10] := 1000;

S := dsolve({deq,iv},{y(t)},type=numeric,method=lsode[adamsfull],ctrl=C);

soln  := S(2.5);
val   := subs(soln[2],y(t));
error := val - exp(2.5);