Rules and simplification question (newbie)



the pattern for
-x^2  looks like

(* -1 (expt x 2))

the pattern for -r^2/t^2

looks like
(* -1 (expt r 2)(expt t -2))

A product of 3 items.  It won't match a pattern of 2 items.

you could try defining a rule like
matchdeclare (negsquare, negsquarematcher);

defrule (rule1,  exp(negsquare), gp(sqrt(-negsquare)))

now figure out the function negsquarematcher(h) :=   ..... something to test 
for the case you want....

RJF

----- Original Message ----- 
From: "Barton Willis" <willisb at unk.edu>
To: "Doug Neubauer" <dougn at integrity.com>
Cc: <maxima at math.utexas.edu>; <dougn at integrity.com>
Sent: Tuesday, May 23, 2006 7:31 PM
Subject: Re: [Maxima] Rules and simplification question (newbie)


> ----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
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>