Re: Re: Question about Replace
- To: mathgroup at smc.vnet.net
- Subject: [mg35732] Re: [mg35718] Re: Question about Replace
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sun, 28 Jul 2002 03:32:03 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
The problem is that the assumption {x+y==x} is exactly the same as {y==0} ,e.g. : Simplify[y + z/(x + y) + e^(x + y) + w*x + y, {x + y == x}] e^x + w*x + z/x which presumably is not what was wanted (if it was than it is much simpler just to substitute y -> 0}? Quite frankly, the original request does not make any mathematical sense at all, at least to me. For a start, it is hard to imagine under what conditions it is reasonable to substitute x for x+y if y is not 0! In addition, what does it mean to say "there is still one more term if we rewrite the answer"? If x+2y "contains" x+y because it can be rewritten as (x+y) + y than so does x+1/2 y since that can be re-written as (x+y)-1/2y and so does any expression. The kind of magic that seems to asked for cannot be achieved either by syntactic pattern matching (because of the need to interpret "contains") or by Simplify which uses wll defined mathematical rules (and in this case the only well defined rule is y==0). Actually on second thoughts I began to suspect that this question is related to another one posted by Heather, concerning simplifying expressions in which x is "much larger than" y. I am not at all sure if a sensible calculus of this kind can be developed but obviously Simplify will not do this. Moreover, it seems to me that under any sensible interpretation of "much larger than", if x+y is approximately x, than so is x+2y, and so on. In other words, x is essentially Infinity in relation to y. If so, there is no reason then why a single y should be left int the answer and x+ (any numeric quantity) y ought to be replaced by just x (without at the same time assuming that y is zero). This sort of thing may perhaps be achieved with the following rule: x + y + z/(x + y) + e^(x + y) + e^y + w*x + y//. x + (k:(_?NumericQ):1)*y -> x e^x + e^y + x + w*x + z/x Andrzej Kozlowski On Saturday, July 27, 2002, at 07:43 PM, Allan Hayes wrote: > "Xuguang(Heather) Zhang" <xuguang_zhang at hotmail.com> wrote in message > news:ahr0mf$l20$1 at smc.vnet.net... >> Hi, Bob, >> >> I tried ReplaceRepeated, however, I got the following answer: >> x+y+z/(x+y)+e^(x+y)+(w*x)+y//. x+y->x >> >> e^x+x+(w*x)+2y+z/x >> >> In fact, there is still one more (x+y) term if we rewritten the answer. > That >> is e^x+(x+y)+y+(w*x)+z/x. Do you know how to get rid of it? Thanks. > > Heather, > > Use Simplify with the assumption x+y=x: > > Simplify[x + y + z/(x + y) + e^(x + y) + w*x + y, {x + y == x}] > > e^x + x + w*x + z/x > > In other circumstances we may have to give more help Simplify (or > FullSimplify). > Please check possiblities in the Help Browser. > > > Allan > > --------------------- > Allan Hayes > Mathematica Training and Consulting > Leicester UK > www.haystack.demon.co.uk > hay at haystack.demon.co.uk > Voice: +44 (0)116 271 4198 > Fax: +44 (0)870 164 0565 > > > > > > > > Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/