Helping out with Maxima



Peddro Vallle hondo wrote:
> There is a recent post in planet.lisp.org about using cffi to use
> a R library by Tamas k Papp (by the way, there is a post in
> the mailing list by Tamas in 2009). See ** below
>
> As R is growing quickly and can use easily libraries in C and fortran,
> it seems that a maxima to R translator is a winning point.
>
> ------------------------------------
> ** Third paragraph from
> ?http://tkpapp.blogspot.com/2011/11/new-and-updated-libraries.html

Indeed i have taken a look at the swig generated wrapper in:
https://github.com/tpapp/cl-rmath/blob/master/cl-rmath.lisp
it is impressive, all the more when you realize that the
cl-math.i which drives the thing is < 30 lines! An example like this shows
that this could be a very efficient way to enhance maxima with little effort.

In fact this is the way through which scientific python has stormed the
scientific community, using external C or fortran programs wrapped with swig
or f2py. This way one benefits of the full speed of the core of the
computation. There is another tool in the python bag of tricks which allows to
intersperse quasi C code and python code to enhance the speed of critical
sections of the code, see for example pyrex:
http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/version/Doc/About.htm
l
or weave, etc. The following example is particularly nice:
http://www.scipy.org/PerformancePython

The timings given at the end of the article are particularly relevant for our
discussion. You will see here that the timings of the computation programmed
with matlab or octave, which have an expression interpreter somewhat analogous
to the one in maxima, are very poor. Using python plus inlined C for the
critical section gives result as fast as straight C. I think that the lesson
is also valid for maxima.


I am sure that similar tricks could be developed for lisp, since it is a more
powerful language than python.

-- 
Michel Talon