Re: Re: Replacement equivalence?
- To: mathgroup at smc.vnet.net
- Subject: [mg63253] Re: [mg63239] Re: Replacement equivalence?
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 20 Dec 2005 23:35:37 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 20 Dec 2005, at 23:43, Andrzej Kozlowski wrote: > > On 20 Dec 2005, at 18:19, David Bailey wrote: > >> carlos at colorado.edu wrote: >>> This is a spinoff of an ongoing thread in s.m.s. Could the >>> nonlinear >>> replacement >>> >>> b^2 -> 1 >>> >>> be changed to the linear one >>> >>> b-> 1||-1 >>> >>> Similarly >>> x^4 -> 16 to x -> 2||-2||2*I||-2*I >>> >>> Any possible side effects? >>> >> Hello, >> >> Quite a few really, for example: >> >> b^2 /. b -> 1 || -1 >> >> (1 || -1)^2 >> >> David Bailey >> http://www.dbaileyconsultancy.co.uk >> > > The only interpretation of the original post that makes any sense > to me is that what the poster was trying to get at is the fact that > the pattern _?(#^2 == 1 &) is equivalent to the pattern 1 | -1. > Indeed: > > > > Cases[{1, -1, 2, -1, 3}, _?(#^2 == 1 &)] > > > {1, -1, -1} > > > > > Cases[{1, -1, 2, -1, 3}, 1 | -1] > > > {1, -1, -1} > > > > Andrzej Kozlowski > > > In fact, however, things are not as simple: b /: b^2 = 1; Cases[{b, 1, -1, 2, -1, 3}, _?(#^2 == 1 & )] {b, 1, -1, -1} Cases[{b, 1, -1, 2, -1, 3}, 1 | -1] {1, -1, -1} Andrzej Kozlowski