On Friday, June 8, 2018 at 9:56:56 AM UTC-7, vdelecroix wrote:
>
>
> 2) Laurent polynomials should conform to the rule (R0) and a / b 
> should always be a rational fraction 
>
> +1 to this. That seems to be the only consistent choice. There is a bit of 
an issue, with the partial "division" operation one would often like to do 
in rings in which one has explicitly inverted some elements (such as 
laurent polynomials, power series, and p-adic numbers):

We have this:

sage: R=Zp(7)
sage: a,b=R(1),R(2)
sage: parent(a/b)
7-adic Field with capped relative precision 20

and often it is suggested that "//" works to stay in the ring, and it does:

sage: parent(a//b)
7-adic Ring with capped relative precision 20

but it is not quite equivalent to the much safer explicit back-conversion 
(which is possibly unduly expensive):

sage: parent(R(a/b))

as you can see in this example:

sage: parent(a//7)
7-adic Ring with capped relative precision 20
sage: parent(R(a/7))
ValueError: negative valuation

The latter is probably the error you'd be hoping for. Instead, "//" does 
some euclidean division and will let you silently continue with the wrong 
result (wrong at least if you get taught "//" is the alternative for "/" 
you should use to stay in the ring)

Incidentally,

sage: parent(a^(-1))
7-adic Field with capped relative precision 20

so at least for p-adics, there is no distinction for 1/a and a^(-1). If 
laurent polynomials were consistent with that, one would need 1//x to get 
the inverse of x ... or use an explicit conversion. Given how laurent 
polynomials are printed, this might be a tad inconvenient. So no rule R0 
for exponentiation in this case? One technical way around that would be to 
have "x" a monomial rather than an element of the ring, but I don't think 
we need *more* parents.


-- 
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 post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to