Hi,
On 22 Mai, 02:29, Kwankyu <[email protected]> wrote:
...
> This seems to me a bug. Isn't it? I am using Sage 3.4.2.
Or at least: It is a very nasty inconsistency -- and note that the
inconsistent behaviour apparently is intended.
At least, it is doc tested:
In the univariate case, we have the doc test
sage: R.<x> = QQ[]
sage: R(0).degree()
-1
and in the multivariate case, we have the doc test
sage: P.<x, y> = QQ[]
sage: P(0).degree(x)
0
sage: P(1).degree(x)
0
I think that it is quite usual to say that the zero polynomial has
*no* degree, while all other constant polynomials have degree 0. And
"no degree" is often accomplished by returning -1. This is done, e.g.,
in Singular:
> ring R = 0, (x,y), dp;
> deg(0);
-1
My vote:
+1 for -1
While we are at it:
sage: Q=singular.ring(0,'(x,y)','dp')
sage: Q(0)
-> boom
I think the __call__ method of *all* rings (including those rings
defined via some interface) should do essentially the same: Try to
interprete the arguments as a ring element.
Cheers,
Simon
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---