Subject: Rules and simplification question (newbie)
From: Barton Willis
Date: Tue, 23 May 2006 21:31:26 -0500
----Doug Neubauer wrote: -----
>I want to apply a rule such that the expression:
>%e^-x^2 is replaced by gp(x)
I'm not sure when you want to make this replacement.
Do you want exp(x) --> gp(sqrt(-x)), for example?
By adding logic to 'f,' maybe you can make 'f' for you.
(%i1) f(e) := subst("^" = lambda([x,p], if x = %e then gp(sqrt(-p)) else
x^p),e)$
(%i2) f(x^2 + y + cos(z));
(%o2) cos(z)+y+x^2 <-- doesn't make any subs
(%i3) f(exp(-x^2) + a^b + exp(-r^2/t^2));
(%o3) gp(abs(x))+gp(abs(r)/abs(t))+a^b
You could clean (%o3) up with assume(x > 0, r > 0, t > 0). Alternatively,
you could try something like:
(%i24) ff(e) := subst("^" = lambda([x,p], block([domain : complex], if x =
%e then
gp(radcan(sqrt(-p))) else x^p)),e)$
(%i25) ff(exp(-25*t^2/s^2));
(%o25) gp((5*t)/s)
(%i26) ff(exp(-25*t^2/s^2) + cos(exp(-z^2)));
(%o26) cos(gp(z))+gp((5*t)/s)
Barton