Toppling the numeric tower

David C. Ullrich ullrich at math.okstate.edu
Fri Jul 27 16:09:07 CEST 2001


On Thu, 26 Jul 2001 08:43:45 -0700, David Eppstein
<eppstein at ics.uci.edu> wrote:

>In article <DLW77.49367$Cy.6275542 at news1.rdc1.az.home.com>,
> "Tim Hochberg" <tim.hochberg at ieee.org> wrote:
>
>> >    1. isnatural()
>> >    2. isintegral()
>> >    3. isrational()
>> >    4. isreal()
>> >    5. iscomplex()
>> >
>> >    a. isexact()
>> 
>> This is too many. I would strip this down to
>> 
>> A. iscomplex()
>> B. isexact()
>> C. isintegral()
>
>I have to say that this would be more convenient for situations such as 
>defining your own extension of number types for, say, exact arithmetic in 
>Q[sqrt(3)].  Or even better Q[sqrt(-3)].  I was wishing I was able to do 
>this recently for a different project unrelated to Python, unfortunately 
>the program I was using didn't make it easy to plug in your own number 
>types...
>
>But a couple points of clarification:
>(1) is it safe to assume that isintegral() implies isexact()?
>(2) should isintegral() return true for algebraic integers that are not 
>rational integers?

Of course not - this would introduce awesome confusion in many
for the sake of the needs of a small number. (Perhaps classes
could have a way to declare themselves as integral or exact or
whatever... then you could make _your_ algebraic integers integral.)

About whether isintegral should imply isexact: I dunno much 
algebra. For the flavors of "algebraic integer" that seem dimly
familiar it seems like one could give an exact representation.
Is this true?

>-- 
>David Eppstein       UC Irvine Dept. of Information & Computer Science
>eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/


David C. Ullrich



More information about the Python-list mailing list