Re: Symbol and Pi and expressions evaluating to Pi
- To: mathgroup at smc.vnet.net
- Subject: [mg70134] Re: [mg70117] Symbol and Pi and expressions evaluating to Pi
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Thu, 5 Oct 2006 03:32:26 -0400 (EDT)
- References: <200610040959.FAA07219@smc.vnet.net>
On Oct 4, 2006, at 5:59 AM, David Bakin wrote: > [I apologize if this question has been asked - as it surely must have > been already - my searches didn't get me to the answer in the > archives. You can send me some better search terms and I'll be happy > with that as an answer, thanks!] > > The Mathematica 5.1 help browser entry for Symbol under "Further > Examples" > defines a function SymbolQ1 to determine if something is a Symbol as > follows: > > Attributes[SymbolQ1] = {HoldAllComplete}; > SymbolQ1[expr_] := AtomQ@Unevaluated[expr] && Head@Unevaluated[expr] > ===Symbol > > Then it shows the following: > > In:= SymbolQ[Pi] > Out= True > In:= {a definite integral evaluating to Pi} == Pi > Out= True > In:= SymbolQ[that definite integral] > Out= False > > Yet FullForm[Pi] is the same as FullForm[that definite integral], > and is Pi. > > So I have two questions: > 1) Why isn't SymbolQ[that definite integral] == True? Because it isn't a symbol it is an expression with the head Integrate, symbols have the head Symbol. > What is it if > it isn't a Symbol? It is an expression whose value reduces to Pi when evaluated. The function SymbolQ1 explicitly does not evaluate its arguments so it doesn't evaluate the integral. You can see this if you use Trace. I suggest you read Appendix A 4 of The Mathematica Book on evaluation, that should clear up the confusion. > 2) Why are FullForm[Pi] and FullForm[that definite integral] > different? I think you mean why are they the same? They are the same because FullForm does not hold its argument unevaluated, so it evaluates the integral and ends up with the expression Pi. For example here's an integral that evaluates to Pi: In[177]:= FullForm[Integrate[(16 x-16)/(x^4-2 x^3+4 x-4),{x,0,1}]] Out[177]//FullForm= Pi Here's the result of comparing its FullForm to Pi IIn[178]:= FullForm[Pi]==FullForm[Integrate[(16 x-16)/(x^4-2 x^3+4 x-4),{x,0,1}]] Out[178]= True Regards, Ssezi
- References:
- Symbol and Pi and expressions evaluating to Pi
- From: "David Bakin" <davidbak@gmail.com>
- Symbol and Pi and expressions evaluating to Pi