(in)exactness of complex numbers

Chris Barker chrishbarker at home.net
Thu Aug 2 18:53:41 EDT 2001


Greg Ewing wrote:
> "David C. Ullrich" wrote:
> > But why should the real and imag of a complex be required to be
> > floats in the first place? Why  shouldn't they be allowed to be
> > floats or rationals or integers?
> 
> A complex number, in the mathematical sense, is
> not a pair of other numbers -- that's just one
> way of *representing* a complex number.

I think this is relevant...
 
> If you have some application for which you
> need pairs of numbers that are restricted to
> being integers or whatever, they're not really
> complex numbers,

But I don't agree with this conclusion. The original question was:

"David C. Ullrich" wrote:
> >> Once these numeric changes are all implemented, if I define a complex
> >> constant with either integer real or imaginary parts, e.g.
> >>
> >>     c = 1+2.1j
> >>
> >>     d = 1.2+5j
> >>
> >>     e = 4+7j
> >>
> >> should I get an integer back (exact) or a float (inexact) when asking for an
> >> attribute that was originally an integer?  In general, can complex numbers
> >> be considered to have two exactness attributes?

As a complex number really is it's own entity, that we choose to
represent as a real and imaginary component (after all, the polar form
is used often as well), it doesn't make any sense to me to maintain two
exactness attributes. A complex number is one number, and it is either
exact or not.

Frankly, it's probably not worth the effort and perfromance hit of
implimenting a form of exact complex numbers, but if it was done, I
would argue that both input values would have to be exact for the number
to be considered exact.

-Chris






-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list