Re: Re: More /.{I->-1} craziness
- To: mathgroup at smc.vnet.net
- Subject: [mg106133] Re: [mg106114] Re: More /.{I->-1} craziness
- From: Leonid Shifrin <lshifr at gmail.com>
- Date: Sat, 2 Jan 2010 05:06:32 -0500 (EST)
- References: <200912300915.EAA17299@smc.vnet.net> <hhhmn8$o9t$1@smc.vnet.net>
Regarding this issue, I think I entirely agree with what David Bailey and other people said: I don't consider replacement rules as a mathematical tool for end users, but rather as an inner layer of Mathematica, which is also exposed for flexibility / convenience and intended primarily to be used by the more advanced users. In this way, they can implement some missing functionality themselves at their own risk without the need to wait for a new Mathematica release. It is stated in the documentation that rule substitution is purely syntax-based, and therefore not guaranteed to always make sense. I don't see how this by itself makes the design inconsistent: either you are the end-user without advanced Mathematica skills and then you have to stick to the built-in commands like Conjugate designed specifically to deal with the problem (complex conjugation here), or you use the lower-level tools like replacement rules but then you are on your own - the system will blindly do the replacements according to the syntax of your rules, and it is then your responsibility to use them correctly. What I would agree with is that the documentation could have made this borderline more clear-cut. But I don't think that this is a problem on the level of design. Regards, Leonid On Fri, Jan 1, 2010 at 2:39 AM, Richard Fateman <fateman at cs.berkeley.edu>wrote: > Leonid Shifrin wrote: > ... > > > > > I think that there are not many more objects in Mathematica which are as > > tricky as <I> or Infinity in terms of pattern-matching. > > > I agree. > That's why it can be fixed. > > Here's a beginning of a short list for the "we're not just talking > syntactic replacement-- version of substitution": > > If the user says -i --> i, then do Complex[a_,-b_] -> Complex[a,b]. > If the user says x^2 --> y, then do x^(-2)-> 1/y also. > > I assume this list can be enlarged somewhat, and could even be left > open-ended by user option of some sort. [e.g. should x^2--> y also > change x^3 to x*y? or to y^(3/2) or ....] > > .... > > > It would perhaps be nice if such > > cases were more systematically documented, but they have nothing to do > with > > bugs, > > You are right if you mean "bug in Mathematica implementation of > intended design" (this is not such a bug). > > But there is another concept: > "bug in Mathematica design, contrary to reasonable mathematical > expectation" > (this IS such a bug). > >