Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Parameter conditions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88656] Parameter conditions
  • From: Steven Siew <siewsk at bp.com>
  • Date: Sun, 11 May 2008 15:16:13 -0400 (EDT)

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