No, it is not. The generic fraction field can only reduce something up to a 
unit since the gcd is defined up to a unit. I agree it looks funny, but I 
don't see a sensible way to code to get a negative sign in the numerator. 
Compare with

sage: ~F(-q+1)
1/(-q + 1)
sage: ~F(q-1)
1/(q - 1)
sage: -1 / F(-q+1)
(-1)/(-q + 1)
sage: -1 / F(q-1)
(-1)/(q - 1)

Of course, there are two distinct elements here, but which ones are the 
"correct" way to print stuff? Not to mention if we are doing something in a 
more general integral domain (or polynomials with a completely different 
implementation).

Something could be done when the denominator is a unit not equal to one 
though. Possibly only in the printing however (i.e., not in the reduce() 
method and its internal representation) in order to reduce the amount of 
computations when manipulating such elements.

Best,
Travis


On Wednesday, September 21, 2022 at 10:22:30 PM UTC+9 axio...@yahoo.de 
wrote:

> sage: R.<q,t> = QQ[]
> sage: F = R.fraction_field()
> sage: ~F(-1)
> 1/(-1)
> sage: 1/F(-1)
> -1
> sage: R.<q> = QQ[]
> sage: F = R.fraction_field()
> sage: ~F(-1)
> -1
>

-- 
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/8b17a45a-c067-45b6-a2e5-5cbd80f8d6f6n%40googlegroups.com.

Reply via email to