Re: why Pi is not recognized as a positive number?

*To*: mathgroup at smc.vnet.net*Subject*: [mg45363] Re: why Pi is not recognized as a positive number?*From*: "Bo Le" <bole79 at email.si>*Date*: Sat, 3 Jan 2004 01:35:07 -0500 (EST)*References*: <bt3e0s$plb$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi, Your first definition has a mistake. A typo? One types g[x_Positive] to define g to arguments with head Positive (g[x_Real] would be more sensible), while f[x_?Positive] to define f to arguments which have this property. More generally, h[x_?test] defines h to arguments, on which the application of test returns True. Your second definition of f is of course correct and also more common, as it is read as 'only when x is Positive'. Bye, Borut Slovenia "Pedro L" <pedrito6 at softhome.net> wrote in message news:bt3e0s$plb$1 at smc.vnet.net... > I wanted to define a function for the positive numbers. But I discovered > something "strange" with Mathematica. > > Could you help me with this? > > Thanks in advance. > > Peter L (Spain) > > > > { > > Cell[CellGroupData[{ > Cell[BoxData["$Version"], "Input", > CellLabel->"In[1]:="], > > Cell[BoxData["\<\"5.0 for Microsoft Windows (June 11, 2003)\"\>"], \ > "Output", > CellLabel->"Out[1]="] > }, Open ]], > > Cell[BoxData[ > RowBox[{ > RowBox[{"f", "[", "x_Positive", "]"}], ":=", > RowBox[{"x", "+", "1", " "}]}]], "Input", > CellLabel->"In[2]:="], > > Cell[CellGroupData[{ > > Cell[BoxData[ > RowBox[{"Positive", "[", "Pi", "]"}]], "Input", > CellLabel->"In[3]:="], > > Cell[BoxData["True"], "Output", > CellLabel->"Out[3]="] > }, Open ]], > > Cell[CellGroupData[{ > > Cell[BoxData[ > RowBox[{"f", "[", "Pi", "]"}]], "Input", > CellLabel->"In[4]:="], > > Cell[BoxData[ > RowBox[{"f", "[", "\[Pi]", "]"}]], "Output", > CellLabel->"Out[4]="] > }, Open ]], > > Cell[BoxData[ > RowBox[{"Remove", "[", "f", "]"}]], "Input", > CellLabel->"In[5]:="], > > Cell[BoxData[ > RowBox[{ > RowBox[{"f", "[", > RowBox[{"x_", " ", "/;", " ", > RowBox[{"x", ">", "0"}]}], "]"}], ":=", > RowBox[{"x", "+", "1"}]}]], "Input", > CellLabel->"In[6]:="], > > Cell[CellGroupData[{ > > Cell[BoxData[ > RowBox[{"f", "[", "Pi", "]"}]], "Input", > CellLabel->"In[7]:="], > > Cell[BoxData[ > RowBox[{"1", "+", "\[Pi]"}]], "Output", > > CellLabel->"Out[7]="] > }, Open ]], > > Cell[BoxData[ > RowBox[{"Remove", "[", "f", "]"}]], "Input", > CellLabel->"In[8]:="] > } > >