MathGroup Archive 2005

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

Search the Archive

Re: Types in Mathematica thread

<posted & mailed>

Andrzej Kozlowski wrote:

> On 6 Dec 2005, at 14:03, Kristen W Carlson wrote:
>> You had me going there, I did look for it :-)
>> Maybe. Another possibility is the ambiguity; an integer, a negative
>> number, a rational, a prime, are all reals.
> Yes, but obviously if the discussion is about types in the sense that
> computer scientists (not me!) use the term, then the type of objects
> with Head Real in Mathematica is exactly what is known as inexact
> numbers, or floating point number or floats etc..

Well, not really.  A float type is typically a specific kind of storage.  In
C++, it is implementation defined as to the exact nature of the type, but
that implementation-provided definition will never have the features that a
Mathematica Real has.  But the use of types in computer science is much
broader than what we find in the limited and archaic example of C/C++
numeric types.  It is also the case that computer scientists will use terms
in context specific ways such that the intended concepts are not
transferable without modification to a different context.  For example, the
term "instantiation" applied to templates means something very different
from what it means for classes.

>> Andrzej, why there isn't a test for transcendentals--TranscendentalQ.
>> That's a joke but I always wanted to see how pi and E were proved to
>> be transcendental. I wonder if there is an algorithm to capture some
>> of them, classes of them or something. Those proofs, since they are
>> finite, must capture some commonality.
> Well, actually the proofs for E and Pi are quite different.

I believe you can derive Pi from E, so it should be possible to prove the
former from the latter.

> But in any case, all this has nothing to do with "types" in the sense
> of computer science.

I don't agree.  I believe what we are dealing with here fits into the notion
of inheritance hierarchies as are found in OOP.  There are cases when one
creates an inheritance hierarchy simply for the purpose of grouping objects
conceptually.  The objects of the distinct classes may verywell have
identical implementations.  The class of the object is merely a means of
tagging it.

Since we really don't have a way of modifying the implementation of such
objects as Pi and E, we may accomplish the same functionality, at least on
a limited scale, using predicates, and explicitly adding those items or
features we are interested in to the predicate tests.  Thus RealQ might
test for everything that is a number, and not Complex.

The Mathematica Wiki:
Math for Comp Sci
Math for the WWW:

  • Prev by Date: Re: Re: Threading 'Append'
  • Next by Date: Re: Zero or one
  • Previous by thread: Re: Re: Re: Re: Re: Types in Mathematica thread
  • Next by thread: Re: Types in Mathematica thread