Sorry, I confused it with valuation, but I guess it is still a related 
question.
On Wednesday 28 February 2024 at 14:36:35 UTC+1 Giacomo Pope wrote:

> This is not what I see on the current beta:
>
> sage: R.<x> = LaurentSeriesRing(QQ)
> sage: R.zero().degree()
> -1
> sage: R.<x> = LazyLaurentSeriesRing(QQ)
> sage: R.zero().degree()
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call last)
> Cell In[4], line 1
> ----> 1 R.zero().degree()
>
> File ~/sage/sage/src/sage/structure/element.pyx:489, in 
> sage.structure.element.Element.__getattr__()
>     487         AttributeError: 
> 'LeftZeroSemigroup_with_category.element_class' object has no attribute 
> 'blah_blah'...
>     488     """
> --> 489     return self.getattr_from_category(name)
>     490 
>     491 cdef getattr_from_category(self, name) noexcept:
>
> File ~/sage/sage/src/sage/structure/element.pyx:502, in 
> sage.structure.element.Element.getattr_from_category()
>     500     else:
>     501         cls = P._abstract_element_class
> --> 502     return getattr_from_other_class(self, cls, name)
>     503 
>     504 def __dir__(self):
>
> File ~/sage/sage/src/sage/cpython/getattr.pyx:357, in 
> sage.cpython.getattr.getattr_from_other_class()
>     355     dummy_error_message.cls = type(self)
>     356     dummy_error_message.name = name
> --> 357     raise AttributeError(dummy_error_message)
>     358 cdef PyObject* attr = instance_getattr(cls, name)
>     359 if attr is NULL:
>
> AttributeError: 'LazyLaurentSeriesRing_with_category.element_class' object 
> has no attribute 'degree'
>
> On Wednesday, February 28, 2024 at 12:05:32 PM UTC Martin R wrote:
>
>> LazyLaurentSeriesRing(QQ) currently gives +Infinity.
>>
>> On Wednesday 28 February 2024 at 12:50:45 UTC+1 Giacomo Pope wrote:
>>
>>> While chasing various bugs which appeared in the CI, I ended up adding a 
>>> small method for computing random elements for the LaurentPolynomialRing 
>>> class.
>>>
>>> When writing randomised testing I got myself confused about the degree 
>>> of the zero polynomial. For the univariate and multivariate polynomial 
>>> rings, we currently use that the degree for 0 (both R(0).degree() as well 
>>> as R(0).degree(x)) is -1. This is unambiguous for the case of these types.
>>>
>>> However for the LaurentPolynomialRings, a polynomial with negative 
>>> valuation is very natural. For example the following code snippet shows the 
>>> ambiguity.
>>>
>>> sage: L.<x> = LaurentPolynomialRing(QQ)
>>> sage: f = (1/x); f
>>> x^-1
>>> sage: f.degree()
>>> -1
>>> sage: L.zero().degree()
>>> -1
>>>
>>> I don't feel familiar enough with the mathematics here and the usual use 
>>> cases in sage to offer a PR "fixing" this, or whether it even needs fixing. 
>>> However, I got confused so I thought maybe others might get confused and 
>>> someone on this list might have a suggestion.
>>>
>>> I think the "usual" suggestion would be to have the degree as -infty, 
>>> but then there's a question about whether this should be done for other 
>>> polynomial rings...
>>>
>>> I made an issue for this on GitHub too:
>>>
>>> https://github.com/sagemath/sage/issues/37491
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/c9c805f9-fbd0-4591-8729-002f3ad90fa1n%40googlegroups.com.

Reply via email to