question about numerical routines



 

> -----Original Message-----
> From: maxima-admin at math.utexas.edu 
> [mailto:maxima-admin at math.utexas.edu] On Behalf Of sen1 at math.msu.edu
> Sent: Thursday, August 03, 2006 8:31 AM
> To: maxima at math.utexas.edu
> Subject: question about numerical routines
> 
> Hello,
>   As I understand it, using the lisp interface to maxima, one can call
>   up routines from other languages (e.g. C, C++, Fortran).  So, why is
>   it important to develop advanced numerical routines in 
> maxima itself?

The main motivation is to make the code work in every version of maxima,
regardless of whether it is running on intel, powerpc, windows, mac, linux,
etc without the many issues of interfacing with the libraries, especially
with multiple lisp systems.  It may also be motivated by a desire to allow
programs to run with exact rational arithmetic, bigfloats, etc.  But I think
that is secondary.
> 
> In particular, doesn't it make sense to simply improve the 
> I/O methods to call tested routines from C or fortran (where 
> they have been tested and used time and time again)?
> 
This is the job of the lisp implementers, and for some implementations it
has been developed quite well.  So if you pick a particular lisp it is not
hard.

> Incidentally, from my point of view this last activity needs 
> much work.
> 
> I am new to maxima and lisp.  I have experience with C and 
> fortran, although it has been awhile since I actually did coding.
> 
> It seems to me that, if I want to use, say a QR algorithm, or 
> an existing  high precision toolbox, then I  have to learn 
> enough of lisp to be able to call those routines, and the way 
> I call them is probably dependent on which other librairies I 
> am using.
> 
> Wouldn't make sense to have maxima commands to do the following.
> 
> a. With the maxima distribution, there are particular GPL 
> fortran, C, C++ libraries to install (just as there currently is GCL).

Why would you restrict yourself to GPL libraries?

> 
> b. With the appropriate maxima command, one transparently 
> calls those routines (as functions or procedures), and maxima 
> handles all the I/O required.

I think you mean the calling conventions for passing parameters, rather than
I/O.  
> 
> BTW, if this is, more or less, already available, then I 
> don't know how to do it.  I would love to have some guidance 
> beyond the to_lisp command.

The to_lisp command is not the way to do what you want. Look at foreign
function interfaces in the lisp you are using. There is also UFFI, an
attempt to be "universal", which might have some promise. 
What you want is quite doable (I've been using C and Fortran code from Lisp
since about 1979), and there are also ways of using Java...  but it
generally requires attention to specific details. While a package to do
"everything automatically" would be nice, it would probably have to deal
with so many eventualities as to be "not everything" and/or "not quite
automatically.".
(And one way is to translate fortran to lisp :) )


> 
> Thanks for any ideas.
> 
> -Cheers,
>   -sen
> 
> 
> --
>   
> --------------------------------------------------------------
> -------------
>   | Sheldon E. Newhouse            |    e-mail: 
> sen1 at math.msu.edu           |
>   | Mathematics Department         |       			
> 	   |
>   | Michigan State University      | telephone: 517-355-9684  
>               |
>   | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562  
>               |
>   
> --------------------------------------------------------------
> -------------
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>