Exporting functions (for use in other applications)
Subject: Exporting functions (for use in other applications)
From: Max
Date: Wed, 29 Jun 2005 21:09:02 +0200
On Tuesday 28 June 2005 06:31, Robert Dodier wrote:
Hi Robert,
> By the way what are the huge functions you mention below?
> That sounds interesting.
It's just some (probably not really interesting) trigonometric functions.
After I had maxima take a diff() on one of them, I decided that I'm _not_
going to type that into my text editor myself anymore. :-)
> 3 ideas here:
> (1) The gentran add-on library (maxima/share/contrib/gentran/).
> The documentation claims gentran can output Fortran, C, and Ratfor,
> but I can't make it work for me. Rats! Does anyone know
> more about gentran?
I can't even figure out how to invoke gentran from maxima?
tex() and fortran() "just work".. (and tex() looks pretty cool btw.. will have
to play with that more later).
Do I have to load() some file for gentran? I looked at it's directory but
couldn't find any file that looks like it could get load()ed by maxima (which
means nothing as I don't know lisp at all). There doesn't seem to be any
documentation for maxima+gentran, is there?
There is some site on google that mentions the statement gentran(eval(e)); and
the output language seems to be configurable through an environment variable.
Anyway, calling gentran() does not work here.
> (2) Generate Fortran as above and then translate Fortran->C
> using f2c (search the web for f2c).
That seems to work. It takes some find & replaces to clean up the code, but it
gets the thing done.
> > I have found the save() function, but that saves the function
> > in some for me rather hard to parse format.
>
> save stores stuff as Lisp expressions. That is more convenient
> for internal manipulations. Incidentally Maxima is written in Lisp.
lisp looks horrible to me ;-) I should take a look at that language some time.
thanks for your help,
Max