MathGroup Archive 2010

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

Search the Archive

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

  • To: mathgroup at
  • Subject: [mg106203] Re: More /.{I->-1} craziness
  • From: Richard Fateman <fateman at>
  • Date: Tue, 5 Jan 2010 01:43:50 -0500 (EST)
  • References: <> <hhhmn8$o9t$> <hhkjc4$5ag$> <hhpl4j$9mf$>

David Bailey wrote:
> Richard Fateman 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).
> Would you really want to use a system which had been arbitrarily hacked 
> by well meaning individuals to create exceptions that suited their taste?

Are you describing Mathematica here?   It seems to me that it is an 
exception that Head[a+b*I] is Plus, but Head[3+4I] is Complex.

> Perhaps the documentation should make it clearer which operations are 
> supposed to always perform mathematically valid operations, and which 
> are meant to operate on the structure of expressions, oblivious to their 
> meaning. 

You assume that people read the documentation. This is provably false.

I think this is an important distinction. If you pass an
> expression to Integrate (say), you expect to get the integral of that 
> expression back as a result (possibly in symbolic form still involving 
> an integral sign) - anything else is a bug.

Or an error message like "division by zero" or "out of memory".

  However, other operations -
> such as ReplaceAll - are not *defined* mathematically, they are defined 
> structurally, and as I pointed out earlier, can be used to produce 
> explicitly invalid expression transformations.
This is obviously not the view of the person who initially posted this 

> Are you really saying that Mathematica doesn't need structural 
> operations?

Just that people want other kinds of operations for substitution. This
should be obvious from the subject line,  I -> -I   etc.

  If it does, why pick on ReplaceAll?

Because this is enshrined in the syntax of the user language, and 
APPEARS  (falsely, as it turns out) to be a mathematical operation.

  • Prev by Date: Re: Wrong ODE solution in Mathematica 7?
  • Next by Date: Re: Combining data from indexed lists efficiently
  • Previous by thread: Re: More /.{I->-1} craziness
  • Next by thread: Re: More /.{I->-1} craziness