Problem with translate_file() in Maxima-5.25.1



Hello,

I have an adaptive Runge-Kutta function for Maxima which I wrote a while ago.
The recent posts in the "Lisp programming and Emacs" thread encouraged me to
try to produce a quicker translated/compiled version using flonum arrays. However
I encountered a problem with translate_file() using Maxima-5.25.1. My attached
rkck() function translates, compiles and runs when used interactively. But
attempting to load the .LISP file produced by translate_file() results in
       loadfile failed to load ... -- an error ...
The .UNLISP file doesn't record a problem. There is no problem with 
translate_file() using Maxima-5.20.1. The problem occurs in 5.25.1 with CLISP-2.48
on Linux and with GLC-2.6.8 on Windows XP.

On comparing the .LISP files produced by 5.25.1 and 5.20.1, I noticed that in
a number of places my 5.25.1 version has hashes where the 5.20.1 version has code.
The first # in the attached rkck-25.LISP corresponds to
(MAP1 (GETOPR (TRD-MSYMEVAL $NUMBERP '$NUMBERP)) (ADD* $Y $K1))
in rkck-20.LISP. The next # corresponds to (MARRAYREF $XRAHM 1).
There are quite a few more cases. I originally had catch() and errcatch() in the
function. They made translate_file() give up altogether.

On 14th October, on the "Lisp Programming and Emacs" thread, Panagiotis
Papasotiriou gave an example function, foo(), and noted that the line
        define(funmake(f_rhs,cons(interval[1],funcs)),odes),
didn't translate. If you do the consing beforehand,as
        vars:cons(interval[1],funcs),
        define(funmake(f_rhs,vars),odes),
it will translate, but trying to run the translated code produces
        Error in APPLY [or a callee]: The function MDEFINE is undefined.
In interactive mode
        (vars:[x,y],odes:[xy])$
then
        :lisp (MEVAL '(($DEFINE) (($FUNMAKE) $F_RHS $VARS) $ODES));
does the define-funmake, but I haven't managed to make ?MEVAL work.
Q1) How can MEVAL be used in program mode?

Giving up on define,
        f_rhs:buildq([v1:vars,v2:odes],lambda(v1,v2)),
translates and runs.
The problem with this is that the 4th order Runge-Kutta program, rk, (the last
function in .../share/dynamics/dynamics.mac) uses
        define(funmake(f_rk_4,cons(domain[1],state)),odes),
        translate(f_rk_4),
in order to translate the function after it has been defined. This is desirable
to speed up evaluation of f_rk which provides the derivative values. However
it's no use calling translate(f_rhs) after the buildq-lambda statement, in this
case f_rhs isn't a function.
Q2) Is there any way of translating an anonymous function and attaching a name
to it?

The simple solution is to make the derivative evaluation function an input
parameter, and leave it up to the user to translate it or compile it beforehand.
But, in order to get a fast, array based function it seems better to
build it in the program, as rk does, rather than rely on the user. Then the
translation problem returns.

Thank you for Maxima and any assistance you can offer

Kevin Gregson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rkck.mac
Type: application/octet-stream
Size: 8703 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20111109/95c3bef4/attachment-0003.obj>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rkck-20.LISP
Type: application/octet-stream
Size: 16810 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20111109/95c3bef4/attachment-0004.obj>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rkck-25.LISP
Type: application/octet-stream
Size: 20065 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20111109/95c3bef4/attachment-0005.obj>;