Translating Maxima functions.



Panagiotis Papasotiriou wrote:
> All necessary stuff can be found in
> https://sites.google.com/site/pjpapasot/maxima/temporary
>
> The code in question is the function "rkf45" and its translated version,
> "rkf45_translated". These are basically the same. The only difference is
> that in rkf45_translated the first argument is passed as a function created
> by the user in main program, while in the non-translated code, rkf45, the
> function is created dynamically. I needed to change this in order to be able
> to translate the code (discussion about this a previous thread.)
>
> To test the codes, run the "driver" program Test.mac, which solves a stiff
> problem (so that it takes more time than usual and the difference in time
> execution is more pronounced.) In my system (Quad Core processor @ 4 x 3
> GHz, 4Mb RAM, running Debian GNU/LInux, 64 bit version), solving the problem
> using non-translated code rkf45 takes about 31 seconds, while translated
> code needs about 32.5 seconds.

I continue to think there is something strange on your machine. On my laptop
here (Mac Air) the program runs faster (and the translated code is faster):

lilas% \maxima
Maxima 5.25.1 http://maxima.sourceforge.net
using Lisp SBCL 1.0.47
??

                         2    3
(%i7) sol_stiff : rkf45(y  - y , y, d, [x, x_start, x_end],
                                         max_iterations = 40000, report =
true)
------------------------------------------------------
Info: rkf45:
   Integration points selected: 30209
    Total number of iterations: 35145
           Bad steps corrected: 4937
       Minimum estimated error: 1.965404499142395e-19
       Maximum estimated error: 9.99978753725041e-7
Minimum integration step taken: 0.344084594619511
Maximum integration step taken: 51200.0
------------------------------------------------------
Evaluation took 17.9590 seconds (18.1830 elapsed) using 4426.317 MB.
                                            2    3
(%i8)                        odes(x, y) := y  - y
Evaluation took 0.0000 seconds (0.0000 elapsed) using 0 bytes.
(%i9)                           translate(odes)
Evaluation took 0.0060 seconds (0.0070 elapsed) using 260.758 KB.
(%i10) sol_stiff : rkf45_translated(odes, y, d, [x, x_start, x_end],
                                         max_iterations = 40000, report =
true)
------------------------------------------------------
Info: rkf45:
   Integration points selected: 30211
    Total number of iterations: 35149
           Bad steps corrected: 4939
       Minimum estimated error: 1.965404499142395e-19
       Maximum estimated error: 9.998794583131294e-7
Minimum integration step taken: .3440845946200041
Maximum integration step taken: 51200.0
------------------------------------------------------
Evaluation took 15.5930 seconds (15.7270 elapsed) using 4607.490 MB.
(%i11)                         showtime : false
(%o11)                 /Users/michel/Downloads/Test.mac



-- 
Michel Talon