[sage-devel] Re: Coercion and exception handling

2009-03-11 Thread Nicolas M. Thiery
Hi Robert, It's surprising that we end up catching SyntaxErrors! Isn't it? I'll try to make a reproducible example. Yes, I think we could greatly reduce the number of exceptions caught. At most, TypeError, NotImplementedError, and perhaps ValueError. Great! Also, I think I

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Ralf Hemmecke
On 03/11/2009 12:49 AM, Nicolas M. Thiery wrote: [snip] In short: for = in, if it was just me, I would only use the most absolutely trivial coercions. And in particular avoid there all the coercions that involve projections and not embedding (like Z - Z/nZ) Just my own feeling ...

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Ralf Hemmecke
Currently the rule is that if you can do arithmetic between two elements, you can compare them. Membership code is something entirely different. Very mathematical... Is the imaginary i bigger or smaller than 1? [snip] Membership is much more lenient than coercion, for example, I would

[sage-devel] Re: Coercion and exception handling

2009-03-11 Thread Nicolas M. Thiery
Wish you had brought this up sooner. The other day I was looking at that code and thinking oh, I could get rid of catching stuff there but as it wasn't relevant to what I was doing at the time and I didn't see any urgency it went on my todo later list. I'll put up a patch soon.

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Nicolas M. Thiery
On Tue, Mar 10, 2009 at 06:27:41PM -0700, Robert Bradshaw wrote: Currently the rule is that if you can do arithmetic between two elements, you can compare them. Ok, I am not used to it, but this seems fair enough. Membership code is something entirely different. I typically write

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Ralf Hemmecke
In short: for = in, if it was just me, I would only use the most absolutely trivial coercions. And in particular avoid there all the coercions that involve projections and not embedding (like Z - Z/nZ) Just my own feeling ... And mine. Ralf

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Florent Hivert
On Wed, Mar 11, 2009 at 08:27:14AM +0100, Ralf Hemmecke wrote: In short: for = in, if it was just me, I would only use the most absolutely trivial coercions. And in particular avoid there all the coercions that involve projections and not embedding (like Z - Z/nZ) Just my own feeling

[sage-devel] Re: Test failing on ImportError: cannot import name Set...

2009-03-11 Thread Florent Hivert
Dar all, I'd rather fix the infrastructure if at all possible ... It should be fairly simple to add a wipe option that kills all left over pyc and so build remnants, but I personally tend to wipe out build and just rebuild the Sage library if I can't manually fix it in 2

[sage-devel] Re: Test failing on ImportError: cannot import name Set...

2009-03-11 Thread Jason Grout
Florent Hivert wrote: Dar all, I'd rather fix the infrastructure if at all possible ... It should be fairly simple to add a wipe option that kills all left over pyc and so build remnants, but I personally tend to wipe out build and just rebuild the Sage library if I can't manually

[sage-devel] Re: 3d display: x3d?

2009-03-11 Thread Prabhu Ramachandran
On 03/10/09 16:41, Jason Grout wrote: http://nb.hpfem.org/home/pub/16 I just installed FreeWRL and looked at this. Awesome! It looks like this might be the best way to get good opengl graphics (and mayavi!) in the sage notebook while we still wait on the possibility of an html

[sage-devel] Re: Build of sagemath_3.0.5dfsg-2ubuntu1 using prevu fails on Kubuntu Intrepid

2009-03-11 Thread R (Chandra) Chandrasekhar
Tim Abbott wrote: I'm guessing your issue is too old m4ri. Try upgrading to libm4ri-dev from jaunty. Thank you. Installing libm4ri-dev from jaunty allowed sagemath to be built. After that, I needed to I needed to compile from source the following packages: lcalc gfan gap-guava libcdd-test

[sage-devel] Re: Build of sagemath_3.0.5dfsg-2ubuntu1 using prevu fails on Kubuntu Intrepid

2009-03-11 Thread Jaap Spies
R (Chandra) Chandrasekhar wrote: Dear Folks, I am on an AMD64 PC running Kubuntu Intrepid 8.04 and KDE4.2. The Linux kernel is 2.6.27-11-generic. I downloaded the source package sagemath_3.0.5dfsg-2ubuntu1 from the jaunty archives and tried compiling it, after having installed other

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Bill Page
Nicolas M. Thiéry wrote: In short: for = in, if it was just me, I would only use the most absolutely trivial coercions. And in particular avoid there all the coercions that involve projections and not embedding (like Z - Z/nZ) +1 I think the new coercion model in Sage is much too

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Georg S. Weber
On 11 Mrz., 14:06, Bill Page bill.p...@newsynthesis.org wrote: Nicolas M. Thiéry wrote: In short: for = in, if it was just me, I would only use the most absolutely trivial coercions. And in particular avoid there all the coercions that involve projections and not embedding (like Z -

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Bill Page
On Wed, Mar 11, 2009 at 12:15 PM, Georg S. Weber wrote: On 11 Mrz., 14:06, Bill Page wrote: I think the new coercion model in Sage is much too aggressive - especially as applied when coding. As Ralf said: perhaps it makes sense for interactive use. Would it be possible to enable/disable

[sage-devel] Re: Coercion and exception handling

2009-03-11 Thread Carl Witty
On Tue, Mar 10, 2009 at 6:01 PM, Robert Bradshaw rober...@math.washington.edu wrote: Most of the errors caught are because it's trying to detect an action, i.e. given a*b, it tries out a._rmul_(b) and, if successful, registers that as an action, but otherwise goes on to try the next thing.

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Carl Witty
On Tue, Mar 10, 2009 at 11:05 PM, Nicolas M. Thiery nicolas.thi...@u-psud.fr wrote: I guess it all boils down to what are the convention for membership testing, and how much freedom one has in implementing it. Here are some typical options: (1) x is in P if there is an element of P that is

[sage-devel] What was the controversy over assumed multiplication ?

2009-03-11 Thread seber...@spawar.navy.mil
It was great going to the Sage Days in San Diego and seeing the very capable Sage crew including W.S. I was curious about something the team said about a controversy regarding something that I believe was called assumed or implicit multiplication. I think the controversy was whether to allow

[sage-devel] Re: sage 3.4 under 64-bit SuSE 11.1?

2009-03-11 Thread John Cremona
John, I think we should keep this discussion on-list so I am cc-ing sage-devel. In answer to your question, yes, I have been using Sage on that machine for ages and try to test builds on it whenever I can since it often shows up some strange things. With 3.4.rc1 it works fince apart from that

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Carl Witty
On Wed, Mar 11, 2009 at 10:21 AM, seber...@spawar.navy.mil seber...@spawar.navy.mil wrote: It was great going to the Sage Days in San Diego and seeing the very capable Sage crew including W.S. I was curious about something the team said about a controversy regarding something that I believe

[sage-devel] Re: Test failing on ImportError: cannot import name Set...

2009-03-11 Thread Nicolas M. Thiery
On Wed, Mar 11, 2009 at 03:20:18AM -0500, Jason Grout wrote: Wow, if the price tag on this feature is bumped up to that So, is this what is being asked for: * Whenever you build, compare the list of .pyc files and .so files in the build directory with the list in the source

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Ralf Hemmecke
Some more oil for the fire... sage: K=NumberField(x^2+1, 'a'); K Number Field in a with defining polynomial x^2 + 1 sage: a = K.0 sage: a a sage: a*a -1 sage: a1 False sage: a1 True sage: 1a False sage: 1a True sage: version() 'Sage Version 3.3, Release Date: 2009-02-21' Do I do something wrong

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Carl Witty
On Wed, Mar 11, 2009 at 11:29 AM, Ralf Hemmecke r...@hemmecke.de wrote: Some more oil for the fire... sage: K=NumberField(x^2+1, 'a'); K Number Field in a with defining polynomial x^2 + 1 sage: a = K.0 sage: a a sage: a*a -1 sage: a1 False sage: a1 True sage: 1a False sage: 1a

[sage-devel] Re: Coercion and exception handling

2009-03-11 Thread Florent Hivert
How many places is this used? In my (fairly fresh) Sage session, there are only 9 actions in the action cache (on matrices, number fields, and polynomials). I'd be willing to write the _get_action_ methods for these cases, if it would help kill off some of the excess error catching in

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Carl Witty
On Wed, Mar 11, 2009 at 12:11 PM, Florent Hivert florent.hiv...@univ-rouen.fr wrote: Then x in P means that there is a safe conversion from the parent of x to P.  If this is actually a coercion, then you don't even have to run it; if it's a conversion, then you do have to run it, to test that

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Georg S. Weber
Hi all, we do not seem to understand each other well enough (especially Bill and me). Yet. :-) Let's try an analogy. When compiling C code, you can tell the compiler to silently skip over warnings; or to print out verbose warnings, but to continue; or to treat all warnings like errors and stop.

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Carl Witty
On Wed, Mar 11, 2009 at 1:42 PM, Georg S. Weber georgswe...@googlemail.com wrote: But would you find it helpful to have the possibility to let it act either as gracefully as possible, or to print out verbose warnings (coercions have costs, so if the costs are higher than a specific amount,

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Bill Page
On Wed, Mar 11, 2009 at 5:52 PM, Carl Witty wrote: On Wed, Mar 11, 2009 at 1:42 PM, Georg S. Weber georgswe...@googlemail.com wrote: But would you find it helpful to have the possibility to let it act either as gracefully as possible, or to print out verbose warnings (coercions have costs,

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Carl Witty
On Wed, Mar 11, 2009 at 2:08 PM, Bill Page bill.p...@newsynthesis.org wrote: On Wed, Mar 11, 2009 at 5:52 PM, Carl Witty wrote: This sounds potentially very useful; but option 3 (do a strict subset of coercions/conversions, and stop otherwise) is also tricky to implement.  For instance, if

[sage-devel] Re: Test failing on ImportError: cannot import name Set...

2009-03-11 Thread Robert Bradshaw
On Mar 11, 2009, at 11:45 AM, Nicolas M. Thiery wrote: On Wed, Mar 11, 2009 at 03:20:18AM -0500, Jason Grout wrote: Wow, if the price tag on this feature is bumped up to that So, is this what is being asked for: * Whenever you build, compare the list of .pyc files and .so files in the

[sage-devel] script to profile import time

2009-03-11 Thread Ondrej Certik
Hi, I know there was some script to debug import times, but I just cannot find it anymore. Robert Kern wrote something similar recently: http://thread.gmane.org/gmane.comp.python.enthought.devel/20077 and neither he could find the Sage script for it. Can someone please point us in the right

[sage-devel] Re: script to profile import time

2009-03-11 Thread Carl Witty
On Wed, Mar 11, 2009 at 3:43 PM, Ondrej Certik ond...@certik.cz wrote: Hi, I know there was some script to debug import times, but I just cannot find it anymore. Robert Kern wrote something similar recently: http://thread.gmane.org/gmane.comp.python.enthought.devel/20077 and neither he

[sage-devel] Re: script to profile import time

2009-03-11 Thread Ondrej Certik
and neither he could find the Sage script for it. Can someone please point us in the right direction? :) sage -startuptime (implemented in $SAGE_ROOT/local/bin/sage-startuptime.py) That's it, thanks a lot! I was blind. Ondrej --~--~-~--~~~---~--~~ To post

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread seber...@spawar.navy.mil
Carl Mathematica seems to have been successful with this approach. I'm curious what were the reasons for its disapproval. Perhaps it was feared it was error prone? Chris On Mar 11, 11:36 am, Carl Witty carl.wi...@gmail.com wrote: On Wed, Mar 11, 2009 at 10:21 AM, seber...@spawar.navy.mil

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Mike Hansen
On Wed, Mar 11, 2009 at 4:52 PM, seber...@spawar.navy.mil seber...@spawar.navy.mil wrote: Mathematica seems to have been successful with this approach.  I'm curious what were the reasons for its disapproval.  Perhaps it was feared it was error prone? It's also not valid Python syntax, and

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Jaap Spies
Mike Hansen wrote: On Wed, Mar 11, 2009 at 4:52 PM, seber...@spawar.navy.mil seber...@spawar.navy.mil wrote: Mathematica seems to have been successful with this approach. I'm curious what were the reasons for its disapproval. Perhaps it was feared it was error prone? It's also not valid

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Nicolas M. Thiery
On Wed, Mar 11, 2009 at 01:52:31PM -0800, Carl Witty wrote: On Wed, Mar 11, 2009 at 1:42 PM, Georg S. Weber georgswe...@googlemail.com wrote: But would you find it helpful to have the possibility to let it act either as gracefully as possible, or to print out verbose warnings (coercions

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Nicolas M. Thiery
On Wed, Mar 11, 2009 at 10:07:35AM -0800, Carl Witty wrote: On Tue, Mar 10, 2009 at 11:05 PM, Nicolas M. Thiery nicolas.thi...@u-psud.fr wrote: I guess it all boils down to what are the convention for membership testing, and how much freedom one has in implementing it. Here are some

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Carl Witty
On Wed, Mar 11, 2009 at 5:47 PM, Nicolas M. Thiery nicolas.thi...@u-psud.fr wrote: On Wed, Mar 11, 2009 at 10:07:35AM -0800, Carl Witty wrote: If you want (4), I think you should just write x.parent() == P (or if you know that P is unique, x.parent() is P). Yup. The question is: am I

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Bill Page
On Wed, Mar 11, 2009 at 9:08 PM, Carl Witty wrote: ... Does this mean you want GF(5)(3)*2 and RR(pi)*2 to fail?  These currently work due to coercions that would be unsafe according to my definition. The __mul__ method exported by GF(5) could accept integers as well as elements of GF(5),

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread David Roe
On Wed, Mar 11, 2009 at 9:53 PM, Bill Page bill.p...@newsynthesis.orgwrote: On Wed, Mar 11, 2009 at 9:08 PM, Carl Witty wrote: ... Does this mean you want GF(5)(3)*2 and RR(pi)*2 to fail? These currently work due to coercions that would be unsafe according to my definition. The

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Bill Page
On Wed, Mar 11, 2009 at 10:13 PM, David Roe wrote: On Wed, Mar 11, 2009 at 9:53 PM, Bill Page wrote: On Wed, Mar 11, 2009 at 9:08 PM, Carl Witty wrote: ... Does this mean you want GF(5)(3)*2 and RR(pi)*2 to fail?  These currently work due to coercions that would be unsafe according to my

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Dan Drake
On Wed, 11 Mar 2009 at 04:52PM -0700, seber...@spawar.navy.mil wrote: Mathematica seems to have been successful with this approach. I'm curious what were the reasons for its disapproval. Perhaps it was feared it was error prone? I've written Mathematica notebooks for multivariable calculus

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Jason Grout
seber...@spawar.navy.mil wrote: Carl Mathematica seems to have been successful with this approach. I'm curious what were the reasons for its disapproval. Perhaps it was feared it was error prone? Along with the other reasons people are giving, it may be helpful to remember that it is

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Alex Ghitza
On Thu, Mar 12, 2009 at 2:03 PM, Jason Grout jason-s...@creativetrax.comwrote: seber...@spawar.navy.mil wrote: Carl Mathematica seems to have been successful with this approach. I'm curious what were the reasons for its disapproval. Perhaps it was feared it was error prone? Along

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Jason Grout
Alex Ghitza wrote: On Thu, Mar 12, 2009 at 2:03 PM, Jason Grout jason-s...@creativetrax.com mailto:jason-s...@creativetrax.com wrote: seber...@spawar.navy.mil mailto:seber...@spawar.navy.mil wrote: Carl Mathematica seems to have been successful with this approach.

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Jaap Spies
Jason Grout wrote: Alex Ghitza wrote: On Thu, Mar 12, 2009 at 2:03 PM, Jason Grout jason-s...@creativetrax.com mailto:jason-s...@creativetrax.com wrote: seber...@spawar.navy.mil mailto:seber...@spawar.navy.mil wrote: Carl Mathematica seems to have been successful

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Robert Bradshaw
Wow, this thread has generated a lot of discussion! :) On Mar 11, 2009, at 12:29 PM, Ralf Hemmecke wrote: Some more oil for the fire... sage: K=NumberField(x^2+1, 'a'); K Number Field in a with defining polynomial x^2 + 1 sage: a = K.0 sage: a a sage: a*a -1 sage: a1 False sage: a1

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Robert Bradshaw
On Mar 11, 2009, at 3:07 PM, Florent Hivert wrote: Dear Carl, The paragraph you quoted was part of a very rough proposal for a way that Sage's coercion might be changed in the future; it's definitely not how it works now. My apologies for missing this. Also, the way coercion is

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread William Stein
On Wed, Mar 11, 2009 at 8:14 PM, Alex Ghitza aghi...@gmail.com wrote: On Thu, Mar 12, 2009 at 2:03 PM, Jason Grout jason-s...@creativetrax.com wrote: seber...@spawar.navy.mil wrote: Carl Mathematica seems to have been successful with this approach.  I'm curious what were the reasons

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Robert Bradshaw
On Mar 11, 2009, at 8:17 PM, Jason Grout wrote: Alex Ghitza wrote: On Thu, Mar 12, 2009 at 2:03 PM, Jason Grout jason-s...@creativetrax.com mailto:jason-s...@creativetrax.com wrote: seber...@spawar.navy.mil mailto:seber...@spawar.navy.mil wrote: Carl Mathematica seems to have

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Robert Bradshaw
On Mar 11, 2009, at 9:38 AM, Bill Page wrote: On Wed, Mar 11, 2009 at 12:15 PM, Georg S. Weber wrote: On 11 Mrz., 14:06, Bill Page wrote: I think the new coercion model in Sage is much too aggressive - especially as applied when coding. As Ralf said: perhaps it makes sense for

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Jason Grout
Jaap Spies wrote: Jason Grout wrote: Alex Ghitza wrote: On Thu, Mar 12, 2009 at 2:03 PM, Jason Grout jason-s...@creativetrax.com mailto:jason-s...@creativetrax.com wrote: seber...@spawar.navy.mil mailto:seber...@spawar.navy.mil wrote: Carl Mathematica seems to

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Jason Grout
Robert Bradshaw wrote: Along with the other reasons people are giving, it may be helpful to remember that it is may be less error-prone in MMA. For example, parentheses in Sage can denote function calling as well as grouping, while they only denote grouping in MMA.

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Robert Bradshaw
On Mar 11, 2009, at 5:47 PM, Nicolas M. Thiery wrote: On Wed, Mar 11, 2009 at 10:07:35AM -0800, Carl Witty wrote: On Tue, Mar 10, 2009 at 11:05 PM, Nicolas M. Thiery nicolas.thi...@u-psud.fr wrote: I guess it all boils down to what are the convention for membership testing, and how much

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Dan Drake
On Wed, 11 Mar 2009 at 08:50PM -0700, William Stein wrote: sage: !math Mathematica 6.0 for Linux x86 (64-bit) Copyright 1988-2007 Wolfram Research, Inc. In[1]:= sin(x) Out[1]= sin x On a similar note, we have this: sage: !math Mathematica 6.0 for Linux x86 (64-bit) Copyright

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Jason Grout
William Stein wrote: On Wed, Mar 11, 2009 at 8:14 PM, Alex Ghitza aghi...@gmail.com wrote: On Thu, Mar 12, 2009 at 2:03 PM, Jason Grout jason-s...@creativetrax.com wrote: seber...@spawar.navy.mil wrote: Carl Mathematica seems to have been successful with this approach. I'm curious what

[sage-devel] Re: What was the controversy over assumed multiplication ?

2009-03-11 Thread Jaap Spies
Jason Grout wrote: Robert Bradshaw wrote: Internal consistency is good, but consistency with the vast body of mathematical literature out there is pretty valuable as well. Yes, that is one reason why I am for having all multiplications denoted by *. Most students are familiar with

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Robert Bradshaw
OK, my last post on this tread for a while, I promise :). On Mar 11, 2009, at 7:19 PM, Bill Page wrote: On Wed, Mar 11, 2009 at 10:13 PM, David Roe wrote: On Wed, Mar 11, 2009 at 9:53 PM, Bill Page wrote: On Wed, Mar 11, 2009 at 9:08 PM, Carl Witty wrote: ... Does this mean you want

[sage-devel] Re: element of integermod is element of integer?

2009-03-11 Thread Carl Witty
On Wed, Mar 11, 2009 at 9:35 PM, Robert Bradshaw rober...@math.washington.edu wrote: Here's some examples to hopefully clarify: RealField(20) - RealField(50) RealField(20) - RealIntervalField(20) I would call these dangerous, as the latter implicitly has more information than the former.

[sage-devel] Sage Tutorial: Section 2.3: Suggested addition

2009-03-11 Thread R (Chandra) Chandrasekhar
Folks, I have one suggestion for the Sage Tutorial. In Section 2.3, after the text == sage: def is_even(n): ... return n%2 == 0 == I suggest that you add an instruction to press [Enter/Return/Newline] after the ... return n%2 == 0 to conclude the definition. When I followed

[sage-devel] Re: Sage Tutorial: Section 2.3: Suggested addition

2009-03-11 Thread William Stein
On Wed, Mar 11, 2009 at 10:55 PM, R (Chandra) Chandrasekhar chyav...@gmail.com wrote: Folks, I have one suggestion for the Sage Tutorial. In Section 2.3, after the text == sage: def is_even(n): ...       return n%2 == 0 == I suggest that you add an instruction to press