MathGroup Archive 2002

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

Search the Archive

Re: Gross Bug in Simplify


During the long time I am using Mathematica I met many bugs, but after some
thinking in most cases I found that it was not a bug in Mathematica but a
bug in understanding. I think the same applies to the Gross Bug in
Simplify. To me it seems to be regular behaviour with respect to a rule that
from a mathematical point of view makes no sense. It has nothing to do with
the indicated pattern matching.

Let us have a closer look at the example. A substitution rule is defined for
expressions with head Power. So when entering expressions such as 2 - f[4]
nothing happens since Power is not involved in the evaluation. But since
Simplify has a curious effect, somewhere during the simplification
expressions with head Power must occur.

We can ask Mathematica to print these cases.

Unprotect[Power]; Power[x___] := Null /; (Print["Power"[x]]; False)

ClearAll[f]; Simplify[ 3 + 4 f[4] ]

results in the printing of

Power[f[4],0]
Power[f[4],1]

So it seems that during simplification Mathematica replaces the integer 1
with f[4]^0 and f[4] itself with f[4]^1.

By defining

f[u__]^v_ ^:= f[u]

we allow Mathematica to replace the number 1 with f[4]. It is not
Mathematica that introduces this strange substitution!

Anyway, 3 + 4 f[4] now simplifies along the lines 3*1+4f[4], 3f[4]+4f[4],
7f[4].

That 1-x f[4] does not simplify to (1-x)f[4] is because of the latter
expression is not simpler.

It is an interesting puzzle to explain why 5+f[3]-f[4] now simplifies to
5 f[3] f[4], a product!

Fred Simons
Eindhoven University of Technology




  • Prev by Date: Simple integral problem
  • Next by Date: Re: FindMinimum within a specific interval
  • Previous by thread: Re: Gross Bug in Simplify
  • Next by thread: Re: Gross Bug in Simplify