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

*To*: mathgroup at smc.vnet.net*Subject*: [mg106100] Re: More /.{I->-1} craziness*From*: David Bailey <dave at removedbailey.co.uk>*Date*: Fri, 1 Jan 2010 05:36:45 -0500 (EST)*References*: <hhf5s3$h4o$1@smc.vnet.net> <hhhmfi$o2a$1@smc.vnet.net>

Richard Fateman wrote: > AES wrote: >> The more I play with these I->-I substitution rules, the more seemingly >> wildly inconsistent results emerge. For example: >> >> In[1]:= -I/.I->-I >> >> Out[1]= -I >> > ..snip.. > These examples you give are perfectly consistent with a certain world > view which is that I is not a symbol, but a functional form, > Complex[0,1], and -I is a different form, Complex[0,-1]. > > The fact that this is not what you expect as a mathematician is simply > your fault.:) What you say is true, so I guess this is really a response to your smiley! A comprehensive system like Mathematica clearly has to have operations that are mathematically consistent, and others that operate at a structural level. You could argue (I suppose) that the structural operations (such as ReplaceAll) should be hidden away for Wolfram programmers only, but in fact they are very useful, provided you use them for the right purpose. Thus the expression: Sin[x]+Cos[3 x] /. Sin[a_]->Cos[a] makes no sense at all, but a very similar expression can make perfect sense (if you know that abs(x) is suitably small): Sin[x]+Cos[3 x] /. {Sin[a_]->a-a^3/6,Cos[a_]->1-a^2/2} Mathematica would be quite inflexible if it only had 'valid' math operations. David Bailey http://www.dbaileyconsultancy.co.uk