Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Question about Replace

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35696] RE: [mg35670] Question about Replace
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 26 Jul 2002 04:16:44 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Heather,

It works.

x + y + z/(x + y) + e^(x + y) + w*x + y /. x + y -> x
e^x + x + w*x + 2*y + z/x

Since you wrote w*x + y and not w*(x+y) Mathematica simplified to obtain x +
2y so there is no replacement there.

But generally you will have to use ReplaceRepeated (//.).

x + y + z/(x + y) + e^(x + y) + w*(x + y) //. x + y -> x
e^x + x + w*x + z/x

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



From: Xuguang Zhang [mailto:xzhang2 at is2.dal.ca]
To: mathgroup at smc.vnet.net


Hello All,

I have an expression: x+y+z/(x+y)+e^(x+y)+w*x+y.... I want to replace
any (x+y) term by x no matter how the expression looks like.  I tried
"/."command. However, it does not work properly. Is there any simple way
of doing this? Thanks.

--
Xuguang(Heather) Zhang





  • Prev by Date: Re: Question about Replace
  • Next by Date: AW: Question about Replace
  • Previous by thread: Re: Question about Replace
  • Next by thread: Re: Question about Replace