Thanks, this worked just fine. I wrote a little Tcl/Tk program to
further format the output, and my C program is happily running.
Just to report, I found it very easy to install maxima on my RedHat 7.3
and 8.0 systems and only found one problem:
I tried something like this:
R11: ev(diff(x1, x0, 1), [x0=0,x0p=0,y0=0,y0p=0,delta=0]);
and maxima said
Non-variable second argument to diff.
I split this into two commands with intermediate storage of the
derviative and it worked fine.
--Michael
>From: "Stavros Macrakis" <stavros.macrakis at verizon>
>Reply-To: <macrakis@alum.mit.edu>
>To: "Michael Borland" <mdborland@hotmail.com>
>CC: <maxima@www.ma.utexas.edu>
>Subject: RE: [Maxima] C code generation
>Date: Tue, 19 Nov 2002 10:24:24 -0500
>
> > I need to generate C code from the results of maxima. The
> > string() command almost does it, except it uses a^b form for
> > powers and C doesn't have the ^ operator.
>
>For the simple case (no subscripts, no %I, etc.), the following should
>work.
>
>printval(var):=
> block([val],
> val: var=ev(var),
> val: subst(["^"='pow,%e=euler],val),
> fortran(val));
>
>qq: (x+y)^3-%e^x+sin(log(y));
>
>printval('qq);
>
> qq = (-1)*pow(EULER,x)+pow(y+x,3)+SIN(LOG(y))
>
>If you want to get fancier, you might as well modify the Fortran
>function directly.
>
> -s
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus