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

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 

These would entail excessive burdens that would be difficult to support 
(and for questionable gain). Let me indicate a few of the issues.

First, it is important to have the ability to recognize a NumberQ 
object. Having dedicated heads such as Integer, Real, Rational, and 
Complex, along with internal flagging, is what allows the Mathematica 
evaluator to do that. This would need to be extended to heads Plus, 
Times, and Power for which generic expressions are not NumberQ.

Next, consider what happens when one works with a sum of "terms" 
(products of powers). Among other things, terms that agree up to the 
NumberQ coefficient are grouped together.

In[5]:= FullForm[a + I*a]
Out[5]//FullForm= Times[Complex[1, 1], a]

This would become problematic were e.g. Complex to be replaced by a Plus 
object. Moreover it becomes even to define what Expand should do. If it 
gives a true sum of products then we would have to depart from the above 
grouping in order to support something like Plus[a, Times[I,a]]. If 
instead we retain the collection of terms that agree up to NumberQ 
coefficient, then we would destroy the sum-of-products in supporting an 
Expand'd form of Times[Plus[1,I],a].

I think there would be very real efficiency issues lurking also in basic 
arithmetic. Having dedicated forms for the NumberQ types can go a long 
way to rapid dispatching of arithmetic. You can decide for yourself 
whether you think this is a compelling issue (I do). But the issues 
involving sums of terms have real ramifications that go beyond 
efficiency and into the language semantics.

Daniel Lichtblau
Wolfram Research

  • Prev by Date: Re: Re: my mathematica no longer renders graphics, even after reinstall
  • Next by Date: Re: Re: Re: Bug in 5.1??
  • Previous by thread: Re: Re: Re: Re: Re: Bug Report - Two numerical values for a same variable
  • Next by thread: Re: Re: Re: Bug Report - Two numerical values for a same variable