"(%i4) subst(f = lambda([s],1), f(x));"
Thanks, that worked.
Rich
----- Original Message -----
From: "Barton Willis" <willisb at unk.edu>
To: "Richard Hennessy" <rich.hennessy at verizon.net>
Cc: "Maxima List" <maxima at math.utexas.edu>; "Richard Fateman" <fateman at EECS.Berkeley.EDU>; "Richard Fateman"
<fateman at cs.berkeley.edu>
Sent: Saturday, February 14, 2009 5:11 PM
Subject: Re: [Maxima] Converting a function to one
To avoid ev(..., nouns), substitute a lambda form for the function:
(%i2) g(x) := 1$
(%i3) subst(g,f, f(x));
(%o3) g(x)
(%i4) subst(f = lambda([s],1), f(x));
(%o4) 1
Barton
-----maxima-bounces at math.utexas.edu wrote: -----
>I have an expression containing many calls to the same
>function say
>
>f(someargs)+f(someotherargs)/f(somestuff)
>
>and I
>want to know what is the fastest way to change all of the occurrences of
>this
>function to the number 1. I want/need to do this in my program to
>eliminate pwdelta(someargs)'s inside of an integral and so that is the
>reason
>for my question. I have been doing it a silly way by creating a new
>function and using opsubst(g=pwdelta, expr) where g is defined g(x):=1.
>Is
>that the best way? It is pretty fast, but is there a better way? One
>problem I get is that I have to do an ev(opsubst(g=pwdelta, expr), nouns)
>to get
>Maxima to change the g's to a 1 and I have been observing in the list that
>ev()
>is a problem function.
>
>Thanks for any help,
>
>Rich
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima