MathGroup Archive 2008

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

Search the Archive

Parameter conditions

I'm just curious why the simple code below is not working.

Why is happy[4] not returning the number 200

In[1]:=  happy[p_?PrimeQ] = 100;
           happy[p_?Not[PrimeQ]] = 200;

In[3]:=  Inhappy[4]
Out[3]:= happy[4]

In[4]:=  happy[5]
Out[4]:=  100

  • Prev by Date: Re: Bug in Plot?
  • Next by Date: Re: PlotLegend not working properly in my Mathematica 6
  • Previous by thread: Re: Bug in Plot?
  • Next by thread: Re: Parameter conditions