[sage-devel] Re: coercing of sqrt(2)

2008-06-09 Thread Robert Bradshaw
On Jun 6, 2008, at 10:00 AM, John Cremona wrote: > 2008/6/6 Nick Alexander <[EMAIL PROTECTED]>: >> >>> This thread got slightly off topic to the original question though: >>> where should sqrt(2) belong? Z[sqrt(2)], SR, or somewhere else? >> >> I always want my data to start as close to the initi

[sage-devel] Re: coercing of sqrt(2)

2008-06-06 Thread John Cremona
2008/6/6 Nick Alexander <[EMAIL PROTECTED]>: > >> This thread got slightly off topic to the original question though: >> where should sqrt(2) belong? Z[sqrt(2)], SR, or somewhere else? > > I always want my data to start as close to the initial object as > possible. In this case, Z[sqrt(2)] \into

[sage-devel] Re: coercing of sqrt(2)

2008-06-06 Thread Bill Page
On Thu, Jun 5, 2008 at 6:39 PM, Carl Witty wrote: > > OK, I'm convinced that unifying parents and types is elegant and > works very well in Aldor, and that it's possible in Python. However, > I don't think it's a good idea for Sage, because of pragmatic > limitations due to Python/Cython. These

[sage-devel] Re: coercing of sqrt(2)

2008-06-06 Thread Nick Alexander
> This thread got slightly off topic to the original question though: > where should sqrt(2) belong? Z[sqrt(2)], SR, or somewhere else? I always want my data to start as close to the initial object as possible. In this case, Z[sqrt(2)] \into SR and not vice versa -- so sqrt(2) should be in Z

[sage-devel] Re: coercing of sqrt(2)

2008-06-06 Thread Robert Bradshaw
On Jun 5, 2008, at 3:39 PM, Carl Witty wrote: > On Jun 5, 12:37 pm, "Bill Page" <[EMAIL PROTECTED]> wrote: >> The point I am making is that Python already has everything you need >> to implement the concept of the "parent" of an element as a type, >> i.e. >> directly as an instance of the class

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Gonzalo Tornaria
On 6/5/08, Bill Page <[EMAIL PROTECTED]> wrote: > > On Thu, Jun 5, 2008 at 1:18 PM, William Stein wrote: > > OK, I have to come clean and admit that already actually knew > > all about metaclasses, but considered using them this way so > > unnatural and ugly that I would not recommend it. > >

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Carl Witty
On Jun 5, 12:37 pm, "Bill Page" <[EMAIL PROTECTED]> wrote: > The point I am making is that Python already has everything you need > to implement the concept of the "parent" of an element as a type, i.e. > directly as an instance of the class that creates it. This could > result in considerable sim

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Bill Page
On Thu, Jun 5, 2008 at 5:19 PM, Robert Bradshaw wrote: > > Your Integer object also stands for the ring of Integers. So can > you do stuff like > > sage: ZZ.is_commutative() > True > sage: ZZ.krull_dimension() > 1 > sage: ZZ.is_finite() > False > (1) -> Integer has Finite (1) false

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Robert Bradshaw
On Jun 5, 2008, at 1:36 PM, Bill Page wrote: > On Thu, Jun 5, 2008 at 4:16 AM, Robert Bradshaw wrote: >> >> On Jun 4, 2008, at 7:35 PM, Bill Page wrote: >> ... >> Types are all about the implementations of things, they >> synonymous with the "classes" of Object Oriented programming, >> and are in

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Bill Page
On Thu, Jun 5, 2008 at 4:16 AM, Robert Bradshaw wrote: > > On Jun 4, 2008, at 7:35 PM, Bill Page wrote: > ... > Types are all about the implementations of things, they > synonymous with the "classes" of Object Oriented programming, > and are insufficient (and the wrong vehicle) to carry deeper > m

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Robert Bradshaw
On Jun 5, 2008, at 12:37 PM, Bill Page wrote: > On Thu, Jun 5, 2008 at 1:18 PM, William Stein wrote: >> ... >> On Thu, Jun 5, 2008 at 12:23 PM, Gonzalo Tornaria wrote: >> ... >>> sage: def classinteger(m): >>> ... class A: >>> ... def __init__(self, n): >>> ... self.__n = n % m

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Mike Hansen
>>> sage: def classinteger(m): >>> ... class A: >>> ... def __init__(self, n): >>> ... self.__n = n % m >>> ... def __repr__(self): >>> ... return "%d mod %d" % (self.__n, m) >>> ... A.__name__ = "classintegers mod %d" % m >>> ... return A >>> sage: classin

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Bill Page
On Thu, Jun 5, 2008 at 1:18 PM, William Stein wrote: > ... > On Thu, Jun 5, 2008 at 12:23 PM, Gonzalo Tornaria wrote: > ... >> sage: def classinteger(m): >> ... class A: >> ... def __init__(self, n): >> ... self.__n = n % m >> ... def __repr__(self): >> ... return

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread William Stein
On Thu, Jun 5, 2008 at 9:23 AM, Gonzalo Tornaria <[EMAIL PROTECTED]> wrote: > >> > Python classes can also take parameters. >> >> >> I didn't know that. I thought the only way to create a Python class >> is for the Python interpreter to execute Python code that looks like this: >> >> class Foo

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Bill Page
On Thu, Jun 5, 2008 at 12:23 PM, Gonzalo Tornaria wrote: > On Thu, Jun 5, 2008 at 1:47 AM, William Stein wrote: >> ... How are you going to make, at >> runtime, new classes for each of Z/nZ say, for 1 <= n < 10^5, >> i.e., something like this in Sage: >> >> v = [Integers(n) for n in range(1,10^

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Bill Page
On Thu, Jun 5, 2008 at 1:47 AM, William Stein wrote: > > On Wed, Jun 4, 2008 at 10:16 PM, Bill Page wrote: >> ... >> Python classes can also take parameters. > > I didn't know that. I thought the only way to create a Python class > is for the Python interpreter to execute Python code that looks l

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Gonzalo Tornaria
> > Python classes can also take parameters. > > > I didn't know that. I thought the only way to create a Python class > is for the Python interpreter to execute Python code that looks like this: > > class Foo(...): > ... > > That makes a new class called Foo. How are you going to make,

[sage-devel] Re: coercing of sqrt(2)

2008-06-05 Thread Robert Bradshaw
On Jun 4, 2008, at 7:35 PM, Bill Page wrote: > On Wed, Jun 4, 2008 at 1:54 PM, Robert Bradshaw wrote: >> >> On Jun 4, 2008, at 4:07 AM, Bill Page wrote: >> ... >>> >>> These seem consistent to me, albeit rather complex. However I am >>> not sure I understand the following: >>> >>> sage: parent(In

[sage-devel] Re: coercing of sqrt(2)

2008-06-04 Thread William Stein
On Wed, Jun 4, 2008 at 10:16 PM, Bill Page <[EMAIL PROTECTED]> wrote: > > On Wed, Jun 4, 2008 at 11:06 PM, William Stein wrote: >> >> On Wed, Jun 4, 2008 at 7:35 PM, Bill Page wrote: >>> >>> On Wed, Jun 4, 2008 at 1:54 PM, Robert Bradshaw wrote: David's explanation of this is right on. W

[sage-devel] Re: coercing of sqrt(2)

2008-06-04 Thread Bill Page
On Wed, Jun 4, 2008 at 11:06 PM, William Stein wrote: > > On Wed, Jun 4, 2008 at 7:35 PM, Bill Page wrote: >> >> On Wed, Jun 4, 2008 at 1:54 PM, Robert Bradshaw wrote: >>> >>> David's explanation of this is right on. We need parent() to work >>> in some sensible way on non-Elements (e.g. Python in

[sage-devel] Re: coercing of sqrt(2)

2008-06-04 Thread William Stein
On Wed, Jun 4, 2008 at 7:35 PM, Bill Page <[EMAIL PROTECTED]> wrote: > > On Wed, Jun 4, 2008 at 1:54 PM, Robert Bradshaw wrote: >> >> On Jun 4, 2008, at 4:07 AM, Bill Page wrote: >> ... >>> >>> These seem consistent to me, albeit rather complex. However I am >>> not sure I understand the following

[sage-devel] Re: coercing of sqrt(2)

2008-06-04 Thread Bill Page
On Wed, Jun 4, 2008 at 1:54 PM, Robert Bradshaw wrote: > > On Jun 4, 2008, at 4:07 AM, Bill Page wrote: > ... >> >> These seem consistent to me, albeit rather complex. However I am >> not sure I understand the following: >> >> sage: parent(IntegerRing()) >> >> sage: parent(RealField()) >> >> >>

[sage-devel] Re: coercing of sqrt(2)

2008-06-04 Thread Robert Bradshaw
On Jun 4, 2008, at 4:07 AM, Bill Page wrote: > Robert, > > Thanks for the elaboration. I hope that this follow-up is not too far > off topic and I don't want to distract you (or any of the Sage > developers) from your main tasks. I wrote this mostly as notes and > questions to myself - but if yo

[sage-devel] Re: coercing of sqrt(2)

2008-06-04 Thread Robert Bradshaw
On Jun 4, 2008, at 1:32 AM, John Cremona wrote: > 2008/6/4 Robert Bradshaw <[EMAIL PROTECTED]>: > >> But right now we've already got enough on our plate trying to get the >> changes we have pushed through. (Any help on this front would be >> greatly appreciated.) > > Robert, > > Can you be more s

[sage-devel] Re: coercing of sqrt(2)

2008-06-04 Thread David Harvey
On Jun 4, 2008, at 7:07 AM, Bill Page wrote: > Ok (and thanks also for the clarification, David). There are of course > two different uses of "object" here: 1) object of some category, 2) > Python object. All Python objects have a 'type', i.e. belong to some > Python class. > > So in Sage 3.0.2

[sage-devel] Re: coercing of sqrt(2)

2008-06-04 Thread Bill Page
Robert, Thanks for the elaboration. I hope that this follow-up is not too far off topic and I don't want to distract you (or any of the Sage developers) from your main tasks. I wrote this mostly as notes and questions to myself - but if you or anyone else have some time or the inclination to cor

[sage-devel] Re: coercing of sqrt(2)

2008-06-04 Thread John Cremona
2008/6/4 Robert Bradshaw <[EMAIL PROTECTED]>: > But right now we've already got enough on our plate trying to get the > changes we have pushed through. (Any help on this front would be > greatly appreciated.) Robert, Can you be more specific about how others can help with this? John > > > --

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Robert Bradshaw
On Jun 3, 2008, at 7:11 PM, David Harvey wrote: > On Jun 3, 2008, at 10:04 PM, Robert Bradshaw wrote: > >>> How does it related to the >>> concept of "parent" - which seems equally ill-defined to me? >> >> A Parent is an Object in the category of Sets, > > huh? Don't you mean to say something mor

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread David Harvey
On Jun 3, 2008, at 10:04 PM, Robert Bradshaw wrote: >> How does it related to the >> concept of "parent" - which seems equally ill-defined to me? > > A Parent is an Object in the category of Sets, huh? Don't you mean to say something more like "a parent is an object of a concrete category", i

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Robert Bradshaw
On Jun 3, 2008, at 4:50 PM, Bill Page wrote: > > On Tue, Jun 3, 2008 at 5:48 PM, William Stein wrote: >> >> On Tue, Jun 3, 2008 at 2:45 PM, Bill Page wrote: >>> >>> On Tue, Jun 3, 2008 at 4:48 PM, Robert Bradshaw wrote: On Jun 3, 2008, at 11:17 AM, Gary Furnish wrote: ... > I c

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Gary Furnish
On Tue, Jun 3, 2008 at 7:21 PM, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > On Jun 3, 2008, at 4:36 PM, Gary Furnish wrote: >>> >>> That depends on what they are being used for, but categories lend >>> themselves very naturally to multiple inheritance because of what >>> they are mathematically

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Robert Bradshaw
On Jun 3, 2008, at 4:36 PM, Gary Furnish wrote: >> >> That depends on what they are being used for, but categories lend >> themselves very naturally to multiple inheritance because of what >> they are mathematically. I understand wanting, .e.g., arithmetic to >> be super fast, but I don't see the

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread mabshoff
On Jun 4, 12:39 am, Robert Bradshaw <[EMAIL PROTECTED]> wrote: Hi, > > If coercion was implemented with 100% pure Cython code (with an eye   > > for speed where it is needed), > > The critical path for doing arithmetic between elements is 100% pure   > Cython code. The path for discovering coe

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Bill Page
On Tue, Jun 3, 2008 at 5:48 PM, William Stein wrote: > > On Tue, Jun 3, 2008 at 2:45 PM, Bill Page wrote: >> >> On Tue, Jun 3, 2008 at 4:48 PM, Robert Bradshaw wrote: >>> >>> On Jun 3, 2008, at 11:17 AM, Gary Furnish wrote: >>> ... I consider homsets to be a gigantic flaw in coercion that >>>

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Gary Furnish
On Tue, Jun 3, 2008 at 4:39 PM, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > On Jun 3, 2008, at 3:08 PM, Gary Furnish wrote: > >> >> On Tue, Jun 3, 2008 at 2:48 PM, Robert Bradshaw >> <[EMAIL PROTECTED]> wrote: >>> >>> When a new morphism is created it needs a parent, which is a Homset >>> that

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Nick Alexander
>> One may be able to eek out a bit more performance by doing this, but >> it's not as if performance is awful in the current model. >> > For the things you do. There is no code that pushes the coercion > system anywhere near as much as symbolics in Sage does. Please explain why the symbolics co

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Robert Bradshaw
On Jun 3, 2008, at 3:08 PM, Gary Furnish wrote: > > On Tue, Jun 3, 2008 at 2:48 PM, Robert Bradshaw > <[EMAIL PROTECTED]> wrote: >> >> When a new morphism is created it needs a parent, which is a Homset >> that may be looked up/created at that time. This is probably what you >> are talking about.

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Gary Furnish
On Tue, Jun 3, 2008 at 2:48 PM, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > On Jun 3, 2008, at 11:17 AM, Gary Furnish wrote: > >> On Tue, Jun 3, 2008 at 12:11 PM, Robert Bradshaw >> <[EMAIL PROTECTED]> wrote: >>> >>> On Jun 3, 2008, at 11:06 AM, Gary Furnish wrote: >>> I think we had a dis

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread William Stein
On Tue, Jun 3, 2008 at 2:45 PM, Bill Page <[EMAIL PROTECTED]> wrote: > > On Tue, Jun 3, 2008 at 4:48 PM, Robert Bradshaw wrote: >> >> On Jun 3, 2008, at 11:17 AM, Gary Furnish wrote: >> ... >>> I consider homsets to be a gigantic flaw in coercion that >>> absolutely have to be fixed for me to cons

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Bill Page
On Tue, Jun 3, 2008 at 4:48 PM, Robert Bradshaw wrote: > > On Jun 3, 2008, at 11:17 AM, Gary Furnish wrote: > ... >> I consider homsets to be a gigantic flaw in coercion that >> absolutely have to be fixed for me to consider using more >> of the coercion system in symbolics. > > Ironically, other

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Robert Bradshaw
On Jun 3, 2008, at 11:17 AM, Gary Furnish wrote: > On Tue, Jun 3, 2008 at 12:11 PM, Robert Bradshaw > <[EMAIL PROTECTED]> wrote: >> >> On Jun 3, 2008, at 11:06 AM, Gary Furnish wrote: >> >>> I think we had a discussion on irc about how homsets still got used >>> for determining the result of some

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Gary Furnish
On Tue, Jun 3, 2008 at 12:11 PM, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > On Jun 3, 2008, at 11:06 AM, Gary Furnish wrote: > >> I think we had a discussion on irc about how homsets still got used >> for determining the result of something in parent1 op something in >> parent2 (maybe it was w

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Robert Bradshaw
On Jun 3, 2008, at 11:06 AM, Gary Furnish wrote: > I think we had a discussion on irc about how homsets still got used > for determining the result of something in parent1 op something in > parent2 (maybe it was with someone else?) I sure hope not. If so, that needs to change (but I'm pretty sur

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Gary Furnish
I think we had a discussion on irc about how homsets still got used for determining the result of something in parent1 op something in parent2 (maybe it was with someone else?) I'm also -1 for hard-coding knowledge and logic about ZZ,QQ, etc into the coercion model. I am +1 for hardcoding it int

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Robert Bradshaw
On Jun 3, 2008, at 7:13 AM, Gary Furnish wrote: >>> As long as there are classes in pure python that use MI on the >>> critical path that symbolics has to use, the argument that coercion >>> was written to be fast makes no sense to me. >> >> Not sure what you mean by "MI" here, could you explain.

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread William Stein
On Tue, Jun 3, 2008 at 7:13 AM, Gary Furnish <[EMAIL PROTECTED]> wrote: > The average calculus student coming from maple is not going to > understand why he can't perform a sum of the sqrt of some primes. If > we are to be a viable alternative for non-research mathematicians we > can't run off an

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Gary Furnish
On Tue, Jun 3, 2008 at 2:34 AM, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > On Jun 3, 2008, at 12:09 AM, Gary Furnish wrote: > >> >> On Mon, Jun 2, 2008 at 11:41 PM, Robert Bradshaw >> <[EMAIL PROTECTED]> wrote: >>> >>> On Jun 2, 2008, at 12:55 PM, William Stein wrote: >>> On Mon, Jun 2, 2

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread root
>Maple does > > > 1/(1+I); > 1/2 - 1/2 I Axiom does 1/(1+%i) 1 -- 1 + %i which is of type Fraction Complex Integer, that is a fraction whose numerator and denominator are of type Complex(Integer). You can ask Axiom to place the result i

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Robert Bradshaw
On Jun 3, 2008, at 1:37 AM, John Cremona wrote: > MI = Multiple Inheritance? That's the only thing I can think of, but there isn't any of that in the coercion model... - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread John Cremona
MI = Multiple Inheritance? 2008/6/3 Robert Bradshaw <[EMAIL PROTECTED]>: > > On Jun 3, 2008, at 12:09 AM, Gary Furnish wrote: > >> >> On Mon, Jun 2, 2008 at 11:41 PM, Robert Bradshaw >> <[EMAIL PROTECTED]> wrote: >>> >>> On Jun 2, 2008, at 12:55 PM, William Stein wrote: >>> On Mon, Jun 2, 20

[sage-devel] Re: coercing of sqrt(2)

2008-06-03 Thread Robert Bradshaw
On Jun 3, 2008, at 12:09 AM, Gary Furnish wrote: > > On Mon, Jun 2, 2008 at 11:41 PM, Robert Bradshaw > <[EMAIL PROTECTED]> wrote: >> >> On Jun 2, 2008, at 12:55 PM, William Stein wrote: >> >>> On Mon, Jun 2, 2008 at 12:53 PM, Gary Furnish >>> <[EMAIL PROTECTED]> wrote: -1. First, every