MathGroup Archive 2003

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

Search the Archive

Re: New version, new bugs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42817] Re: New version, new bugs
  • From: Maxim <dontsendhere@.>
  • Date: Wed, 30 Jul 2003 04:07:49 -0400 (EDT)
  • References: <bfdqd8$sfi$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I think it should be mentioned that there are some things that probably
aren't errors but still can be considered as major drawbacks. Consider four
nearly identical expressions:

In[1]:=
f[a] + f[b] + 1 /. HoldPattern[Plus][f[_] ..] /; True :> 0
f[a] + f[b] + 1 /. HoldPattern[Plus[f[_] ..]] /; True :> 0
f[a] + f[b] + 1 /. HoldPattern[Plus][f[_] ..] :> 0 /; True
f[a] + f[b] + 1 /. HoldPattern[Plus[f[_] ..]] :> 0 /; True

Exactly one of them evaluates to 1. This is something from Who Wants to Be a
Millionaire, not a programming language.

Another situation where the result is unpredictable is passing patterns to
functions: can you guess what the result of Integrate[x_,x_] will be? And of
Integrate[_,_]?

Then, of course, there is Mathematica's scoping:

In[1]:=
Module[
  {sub,f},
  sub[a_,b_]:=Module[
      {aa=a,x},
      aa-b
      ];
  f[x_]=sub[x,x]
  ]

Out[1]=
x$-x$38

The problem is that the x in aa and the x in b get renamed differently; I am
not even trying to figure out if it is a bug, I'm just pointing out how
confusing it is (probably it has to do with the fact that assignment in
Module initialization doesn't use Set).

Another example:

In[1]:=
<<discretemath`
UndirectedQ[FromAdjacencyMatrix[{{0,1},{0,0}},Type->Directed]]
<<numbertheory`
UndirectedQ[FromAdjacencyMatrix[{{0,1},{0,0}},Type->Directed]]

Out[2]=
False

Out[4]=
True

Here the situation is clear: the reason for the two different answers is a
name conflict. But it would be nice to at least see a warning message.

Finally, whose brilliant idea was it to give the output for ??In and ??Out
unsorted?

Maxim Rytin
m.r at prontomail.com



  • Prev by Date: Integrate Result depends on symbol used
  • Next by Date: Mathematica program to obtain a bounding function for a set of data points
  • Previous by thread: Re: Re: New version, new bugs
  • Next by thread: Re: New version, new bugs