|
[Date Index]
[Thread Index]
[Author Index]
Re: Expand on RHS of rule
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: Expand on RHS of rule
- From: TODD GAYLEY <TGAYLEY at ccit.arizona.edu>
- Date: Sat, 30 May 1992 17:32 MST
Athos Kasapi asks:
> Has anybody found a way to work around the problem that
> Expand does not work when it is on the right hand side
> of a rule? For example, if I define
> p := Sqrt[ (a + b) (c + d) ]
> and then apply the rule
> p /. Sqrt[ x_ y_ ] -> Sqrt[ Expand[ x y ] ]
> Then all I get back is
> Sqrt[ (a + b)(c + d) ]
> What I wanted was
> Sqrt[ ac + ad + bc + bd ]
What is happening here is that the Expand[x y] is being evaluated
before the substitution of values for x and y. What you need is the
RuleDelayed operator (see p. 258):
p /. Sqrt[x_ y_] :> Sqrt[Expand[x y]]
-------------------------
Todd Gayley
Department of Ecology and Evolutionary Biology
University of Arizona
tgayley at ccit.arizona.edu
Prev by Date:
Re: Expand[] on the RHS of a rule
Next by Date:
Platform speeds
Previous by thread:
text in graphics
Next by thread:
Platform speeds
|