Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5778 > unrolled thread
| Started by | Dushan Mitrovich <dushanm@spinn.net> |
|---|---|
| First post | 2011-10-22 10:10 +0000 |
| Last post | 2011-10-25 10:18 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
algebraic ReplaceAll? Dushan Mitrovich <dushanm@spinn.net> - 2011-10-22 10:10 +0000
Re: algebraic ReplaceAll? Richard Fateman <fateman@cs.berkeley.edu> - 2011-10-24 09:20 +0000
Re: algebraic ReplaceAll? Dushan Mitrovich <dushanm@nnips.net> - 2011-10-25 10:18 +0000
| From | Dushan Mitrovich <dushanm@spinn.net> |
|---|---|
| Date | 2011-10-22 10:10 +0000 |
| Subject | algebraic ReplaceAll? |
| Message-ID | <j7u4qc$t5h$1@smc.vnet.net> |
Is there a way to get ReplaceAll to actalgebraically, so it recognizes
the negative of a replaced quantity as well as the positive? For
example, this works
In: x-w /. x-w->y
Out: y
but these don't
In: -x+w /. x-w->y
w-x /. x-w->y
Out: w-x
w-x
- Dushan
[toc] | [next] | [standalone]
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Date | 2011-10-24 09:20 +0000 |
| Message-ID | <j83alr$k6n$1@smc.vnet.net> |
| In reply to | #5778 |
On 10/22/2011 3:10 AM, Dushan Mitrovich wrote: > Is there a way to get ReplaceAll to actalgebraically, so it recognizes > the negative of a replaced quantity as well as the positive? For > example, this works > In: x-w /. x-w->y > Out: y > > but these don't > In: -x+w /. x-w->y > w-x /. x-w->y > Out: w-x > w-x > > - Dushan > > > > How would you wish the replacement to work on this: -x /. x-w->y ?? would -y-w be ok with you? If so, try -x /. x-> y+w. x-w /. x-> y+w w-x /. x-> y+w etc. You can make the pattern work from w-> x-y alternatively. Or if you want to know if some expression e can be expressed as Q*(x-w)+R, you can do this by polynomial division. Three points: 1. Your request is ambiguous. 2. The pattern matcher basically sucks for this, as Andrzej observes. 3. Alternatives (e.g. semantica, or http://www.cs.berkeley.edu/~fateman/papers/better-rules.pdf ) exist, but item 1. above needs some thought either way. RJF
[toc] | [prev] | [next] | [standalone]
| From | Dushan Mitrovich <dushanm@nnips.net> |
|---|---|
| Date | 2011-10-25 10:18 +0000 |
| Message-ID | <j862e2$5pf$1@smc.vnet.net> |
| In reply to | #5844 |
Richard Fateman wrote: > On 10/22/2011 3:10 AM, Dushan Mitrovich wrote: >> Is there a way to get ReplaceAll to act algebraically, so it recognizes >> the negative of a replaced quantity as well as the positive? For >> example, this works >> In: x-w /. x-w->y >> Out: y >> >> but these don't >> In: -x+w /. x-w->y >> w-x /. x-w->y >> Out: w-x >> w-x >> >> - Dushan >> >> >> > How would you wish the replacement to work on this: > > -x /. x-w->y ?? > > would -y-w be ok with you? > No, it would not be OK: I was only asking about the _negative_ of a quantity being recognized, and I meant only when that negative quantity is a match for the pattern specified. Your example is too complicated, I think, to be practical. > If so, try > > -x /. x-> y+w. > > x-w /. x-> y+w > > w-x /. x-> y+w > > etc. > > You can make the pattern work from w-> x-y alternatively. > > > Or if you want to know if some expression e can be expressed as > Q*(x-w)+R, you can do this by polynomial division. > > Three points: > 1. Your request is ambiguous. > 2. The pattern matcher basically sucks for this, as Andrzej observes. > 3. Alternatives (e.g. semantica, or > http://www.cs.berkeley.edu/~fateman/papers/better-rules.pdf ) > exist, but item 1. above needs some thought either way. Thanks for the 'better-rules' link. I'll give both these a read. - Dushan
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web