On Feb 13, 2008 11:37 AM, R Fateman <fateman at cs.berkeley.edu> wrote:
> 1. I'm not sure why you need this in lisp, if maxima code does it.
My starting point was f90.lisp and since I didn't want the
functionality to be spread between lisp and maxima files I was trying
to put everything inside a lisp file. I also didn't know that it was
this hard to get maxima code running inside lisp. Anyway, it's working
now.
Besides the substitution for pow I also needed ";" at the end of
sentences, no "&" between line breaks and to decrement array accessors
by 1.
> 2. foo(x):=?subst(pow,?mexpt,x); may do what you want.
I got it to work without subst, but what I did was write my own
substitution function in lisp. One thing that I had to be carefull
with was powers like -1 and 1/2, so some extra if's were needed inside
the substitution function to leave these alone (somewhere else maxima
converts them to division and sqrt).
> 3. or not... foo(x^2+a/b) returns pow(x,2)+a*pow(b,-1).
>
> RJF
>
>
> Robert Dodier wrote:
> > On Feb 12, 2008 1:12 PM, Daniel Cabrini Hauagge
> > <daniel.hauagge at gmail.com> wrote:
> >
> >
> >> What I'm trying to do is get this into lisp
> >>
> >> exp_trans: scanmap(lambda([xx],
> >> if mapatom(xx) or op(xx) # "^" then xx
> >> else pow(args(xx)[1], args(xx)[2])), exp);
> >>
> >
> > I think the easiest thing to do is make the above snippet into a function
> > and put it in a separate .mac file, load the .mac, and then call the
> > function via MFUNCALL.
> >
> > ------------ my_xform.mac ------------
> > my_xform (e) := scanmap (blah blah blah, e);
> >
> >
> > ------- somewhere in my_f90.lisp -------
> > ($load "my_xform.mac")
> > ...
> > (setq my-new-expr (mfuncall '$my_xform my-expr))
> > ...
> >
> > HTH
> >
> > Robert Dodier
>
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
> >
>
>
--
Daniel Cabrini Hauagge
cel: +55 (19) 8194-8480