MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at
  • Subject: [mg106160] Re: More /.{I->-1} craziness
  • From: Leonid Shifrin <lshifr at>
  • Date: Sun, 3 Jan 2010 03:42:10 -0500 (EST)
  • References: <> <hhhmn8$o9t$>

On Sat, Jan 2, 2010 at 2:51 PM, DrMajorBob <btreat1 at> wrote:

> I think the way we enter and understand InputForm is syntax; FullForm is
> the way they're stored internally.
> So Mathematica's pattern matching isn't what I'd call syntactical... unless
> you mean "syntactical on a hidden (though discoverable) level".

Yes Bobby,

That's exactly what I mean. When I talk about syntax, I mean FullForm, not
InputForm. Perhaps a more precise way of saying it would be to say that
pattern-matching is based on exact symbolic form (or structure) of the
expression (tree), without any "meaning" attached to any of its parts - this
is what I mean by syntax-based.


> Bobby
> On Sat, 02 Jan 2010 04:06:32 -0600, Leonid Shifrin <lshifr at>
> wrote:
>  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
>> >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).
> --
> DrMajorBob at

  • Prev by Date: Re: algebraic numbers
  • Next by Date: Re: Financial Data - Currencies
  • Previous by thread: Re: More /.{I->-1} craziness
  • Next by thread: Re: More /.{I->-1} craziness