On 03/02/2012 10:18 AM, dlakelan wrote:
> The following patch does just that, and in my testing seemed to work:
the previous patch worked unless you were asking for only the final
result (ie. save_steps was false), the following patch takes care of
that case and replaces the previous patch:
--- rkf45.mac.orig 2012-03-02 10:10:54.726724001 -0800
+++ rkf45.mac 2012-03-02 10:57:22.402724001 -0800
@@ -139,7 +139,7 @@
xi:xc+h,
yi:yi+1.157407407407407e-1*k1+5.489278752436647e-1*k3
+5.353313840155946e-1*k4-0.2*k5,
- if save_steps then sol:endcons(cons(xi,yi),sol),
+ if save_steps then sol:cons(cons(xi,yi),sol),
estimated_errors[1]:min(trunc_error,estimated_errors[1]),
estimated_errors[2]:max(trunc_error,estimated_errors[2]),
step_extrema[1]:min(h,step_extrema[1]),
@@ -180,6 +180,9 @@
print(" accuracy, and/or increase maximum number of
steps.")
),
/* Return solution */
- return(sol)
+ if(save_steps) then
+ return(reverse(sol))
+ else
+ return(sol)
)$
/*----------------------------------------------------------------------------*/