Re: Replacement Rule with Sqrt in denominator

*To*: mathgroup at smc.vnet.net*Subject*: [mg114635] Re: Replacement Rule with Sqrt in denominator*From*: Noqsi <noqsiaerospace at gmail.com>*Date*: Sat, 11 Dec 2010 01:53:33 -0500 (EST)*References*: <idl6vd$mkp$1@smc.vnet.net> <idnqq6$q5i$1@smc.vnet.net> <idsku3$6ko$1@smc.vnet.net>

On Dec 10, 12:30 am, AES <sieg... at stanford.edu> wrote: > In article <idnqq6$q5... at smc.vnet.net>, > > Noqsi <noqsiaerosp... at gmail.com> wrote: > > It is easy to see the kind of chaos the vague and ambiguous "rules > > should be interpreted semantically in a way that makes mathematical > > sense" would cause. How should > > > a + b I /. I->-I > > > be interpreted *semantically*? > > I do not possess anything like the depth of knowledge of symbolic > algebra or the understanding of the principles of semantics that would > embolden me to offer any answer to the preceding question. Oh, come on. This really isn't hard to understand. > > But I will offer the following opinion: However the above rule is to b= e > interpreted, in any decent symbolic algebra system, assuming a and b > have not yet been assigned any values, the symbol I should be > interpreted (i.e., modified) identically -- i.e., in *exactly* the same > fashion -- for either of the inputs > > a + b I /. I->-I OR a + 2 b I /. I->-I > > This is NOT the case in Mathematica. And this is trivially understandable by looking at FullForm. "I" is part of the number in this case: it is not a separate symbol. As well expect 22/.2->1 to yield 11. > This behavior is a "gotcha" that > can be responsible for large and hard to trace difficulties for many > users Sure. And if you use a power saw carelessly, you'll cut your fingers off. That's a worse "gotcha", but it can't be helped in a foolproof way without crippling the saw. Just as this can't be helped without crippling Mathematica. > > Furthermore, I believe that Mathematica WILL interpret (i.e. , modify) > the two inputs above in exactly the same fashion if the character I in > thee two expressions is replaced by ANY OTHER single upper or lower case > letter in the alphabet. Does anyone else find this not to be true? It's a consequence of two very simple considerations: 1. Pattern matching works on FullForm. 2. Pattern matching can't split atoms. What's so hard about this? There are only six kinds of atoms. When using a tool, it's preferable to exploit the way it actually works, rather than make up some impossible notion and complain that it should work that way.