MathGroup Archive 2005

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

Search the Archive

Re: Re: Re: Re: Re: Bug Report - Two numerical values for a same variable


The answer is that actually is is as you expected:

In[5]:=
FullForm[Hold[2 + 3*I]]

Out[5]//FullForm=
FullForm[Hold[2 + 3*I]]



FullForm[Hold[2/3]]


Hold[Times[2,Power[3,-1]]]


What happens is that 2+3 I is not an atom when it is entered


AtomQ[Unevaluated[2+3I]]

False

but after evaluation its FullForm becomes Complex[2,3] and it becomes 
an atom.

There are several plausible reasons for this. The one that convinces me 
most is as I described: so that you can treat all numbers in the same 
when using pattern matching or functions that admit level 
specifications. The other is indeed to do with performance: Real and 
Complex certainly are analogous to types, particularly when you use 
Compile. I am not however sure that this actually needs Complex[2,3] to 
be an atom; pattern matching and levels seems to me a more convincing 
reason.

Andrzej Kozlowski


On 20 Feb 2005, at 06:08, Murray Eisenberg wrote:

> I understand everything you say.  Here's the crux, I think, of my not
> being able to "rationalize" Mathematica's definition of what is or is
> not an atom:
>
> Why is FullForm[2 + 3 I] not Plus[2, Times[3, I]]?
>
> Why is FullForm[2/3] not  Times[2, Power[3, -1]] ?
>
> My suspicion is that this was simply a design decision made for reasons
> of efficiency, and that therefore not much more can be said about it.
> That's what makes it hard for me to swallow and explain to others.
>
> P.S. Unlike some others, I have no difficulty with Mathematica counting
> such things as Complex[E, Pi] as meaningless (although syntactically
> correct).
>
>
> Andrzej Kozlowski wrote:
>> ...
>> Complex[Pi,E] does not have any meaning in Mathemaitca at all. Neither
>> does Complex[Sqrt[2],Sqrt[3]] etc. Complex[a,b] only has a meaning 
>> when
>> a and b are real numbers (exact or approximate).
>>
>> ...
>> Of course all of these statements refer to the design of the language.
>> To me they seem perfectly logical and natural. To you presumably not.
>> Well, then there is nothing else to say.
>
> -- 
> Murray Eisenberg                     murray at math.umass.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower      phone 413 549-1020 (H)
> University of Massachusetts                413 545-2859 (W)
> 710 North Pleasant Street            fax   413 545-1801
> Amherst, MA 01003-9305
>
>


  • Prev by Date: Re: how to find packages when using NETLINK
  • Next by Date: Solving a weakly singular integral equation - Take 2.
  • Previous by thread: Re: Bug Report - Two numerical values for a same variable
  • Next by thread: Is the answer for this Integral correct???