Re: Gross Bug in Simplify

*To*: mathgroup at smc.vnet.net*Subject*: [mg32601] Re: Gross Bug in Simplify*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Thu, 31 Jan 2002 01:45:25 -0500 (EST)*Organization*: Universitaet Leipzig*References*: <a38b1s$1r$1@smc.vnet.net>*Reply-to*: kuska at informatik.uni-leipzig.de*Sender*: owner-wri-mathgroup at wolfram.com

Hi, Mathematica is a bit stupid because it can't read your mind. Hopefully future versions will improve this deficit. 1= f[u]^0 and f[u]=f[u]^1 But your rule f[u__]^v_ ^:= f[u] say f[u]^0 is f[u]. and 1-f[u] -> f[u]^0 -f[u] -> f[u]-f[u] ->0 Mathematica make *exactly* what you say, but it make not what you *mean* In[]:= f[u__]^v_ ^:= f[u] /; v>1 If you formulate the rule correct In[]:= Simplify[f[4] - 1] Out[]=1-f[4] In[]:=Simplify[{1 - f[4], 1 - 7 f[4]^2, 1 + f[4], 1 - x f[4]}] Out[]={1 - f[4], 1 - 7 f[4], 1 + f[4], 1 - x f[4]} > There is a destructive bug in Mathematica (v4.1, win2000) in which Simplify > misparses expressions m + n f[__], where m and n are numeric, as (m+n) > f[__]. One can only wonder how many other rule combinations, with or > without Simplify, are also faulty. A programming system is never protected against the errors of its users. > The following example is a stripped-down version of some rules for f = > Kronecker delta, which explains why the upvalue rule is needed. It is > specifically this rule that seems to be causing the problem with Simplify. > However, it's not the upvalue itself -- the problem remains if Power is > Unprotected and the rule is replaced by Power[f[u__], v_] :> f[u]. > > In[1]:= > Clear[f]; > Simplify[1-f[4]] > f[u__]^v_ ^:= f[u]; > Simplify[{1-f[4], 1 - 7 f[4], 1 + f[4], 1 - x f[4]}] > > Out[2]= > 1-f[4] > > Out[4]= > {0,-6 f[4],2 f[4],1-x f[4]} > > Doesn't WRI test all its built-in functions by running special diagnostic > code on them round the clock? It's hard to imagine how a bug like this > could have gone undetected! WRI tests Mathematica and Mathematica is right here. Regards Jens