MathGroup Archive 2008

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

Search the Archive

Bug in Default[] or Bug in My Understanding?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89201] Bug in Default[] or Bug in My Understanding?
  • From: Salvatore Mangano <smangano at into-technology.com>
  • Date: Thu, 29 May 2008 07:03:42 -0400 (EDT)

In[208]:= ClearAll[f] ;
Default[f,2] = 0;

In[210]:= f[a_, b_.] := a + b

In[211]:= f[1]
Out[211]= 1

In[212]:= (* Now change Default *)
Default[f,2] = 1;

(* Note that Mathematica seems to recognize change *)
In[213]:= ?f
Global`f
f[a_,b_.]:=a+b

f/:Default[f,2]=1


(* But not really! Expected 2 *)
In[214]:= f[1]
Out[214]= 1

Even if it is a rule that you can't change the Default after the function is defined it is certainly not nice of Mathematica to allow such a change and advertise the change in the output of Definition[] and Information[].

I am using 6.0.2.0 on Windows XP.


  • Prev by Date: Re: Plot3D crashes Mathematica 6.02
  • Next by Date: Re: Plot3D crashes Mathematica 6.02
  • Previous by thread: Q: How to print with line wrap AND syntax coloring?
  • Next by thread: Re: Bug in Default[] or Bug in My Understanding?