Re: More /.{I->-1} craziness

*To*: mathgroup at smc.vnet.net*Subject*: [mg106293] Re: More /.{I->-1} craziness*From*: Noqsi <jpd at noqsi.com>*Date*: Thu, 7 Jan 2010 02:33:08 -0500 (EST)*References*: <200912300915.EAA17299@smc.vnet.net> <hhhmn8$o9t$1@smc.vnet.net>

On Jan 6, 3:59 am, Richard Fateman <fate... at cs.berkeley.edu> wrote: > > For example, Exp[I x] -Exp[- I x] /. Exp[I x] -> s should p= robably > result in s-1/s. > In Mathematica, one gets s-E^(-Ix). You're confusing two different kinds of "substitution". It is extremely important to preserve the distinction. > > can either > (1) Make this come out s-1/s > or > (2) Argue that Mathematica already does the right thing, blame the user, > blame the documentation, blame the nature of mathematics, claim that it > is impossible to "read the user's mind" etc. Or blame those who don't understand critical distinctions and want to erase them. > > To me, the question is simply, by what programming technique can we make > Mathematica do the truly expected thing. Well, in this case it does what anybody who understands how Replace works and what it's good for expects. If that's not the "truly expected thing", I don't know what is. > In this case, and I believe in every other case, a transformation of the > rules will help. In particular, using the rule > x-> -I Log[s] instead of Exp[x I] -> s. Mathematica has a tool that can do what you want here: Reduce[a == Exp[I x] - Exp[-I x] && Exp[I x] == s, {a}, {x}] s != 0 && a == (-1 + s^2)/s It's a bit fussier than perhaps you'd like, but that's mathematics for you ;-)