ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 28 Jan 2022 23:35:02 +0100reduce() for fraction field elementshttps://ask.sagemath.org/question/60856/reduce-for-fraction-field-elements/I am having an issue with the `reduce()` method for `FractionFieldElement`.
In a Jupyter notebook I executed the following code
sage: S = FractionField(QQ['t'])
sage: S.inject_variables()
sage: R = PolynomialRing(FractionField(QQ['t']),'x',3)
sage: R.inject_variables()
sage: (((x0^2-x1^2)/(x0-x1)).reduce())
but this returned an object with `NoneType`, rather than
a fraction field element or ring element. What am I doing wrong?Fri, 28 Jan 2022 17:06:38 +0100https://ask.sagemath.org/question/60856/reduce-for-fraction-field-elements/Answer by rburing for <p>I am having an issue with the <code>reduce()</code> method for <code>FractionFieldElement</code>.
In a Jupyter notebook I executed the following code</p>
<pre><code>sage: S = FractionField(QQ['t'])
sage: S.inject_variables()
sage: R = PolynomialRing(FractionField(QQ['t']),'x',3)
sage: R.inject_variables()
sage: (((x0^2-x1^2)/(x0-x1)).reduce())
</code></pre>
<p>but this returned an object with <code>NoneType</code>, rather than
a fraction field element or ring element. What am I doing wrong?</p>
https://ask.sagemath.org/question/60856/reduce-for-fraction-field-elements/?answer=60860#post-id-60860See the [documentation of reduce](https://doc.sagemath.org/html/en/reference/polynomial_rings/sage/rings/fraction_field_element.html#sage.rings.fraction_field_element.FractionFieldElement.reduce): it modifies the element instead of returning a new copy. So:
sage: f = (x0^2-x1^2)/(x0-x1)
sage: f.reduce()
sage: f
x0 + x1
Also read in the documentation:
> Automatically called for exact rings, but because it may be numerically unstable for inexact rings it must be called manually in that case.
So there is no point in calling it in your particular case.Fri, 28 Jan 2022 23:35:02 +0100https://ask.sagemath.org/question/60856/reduce-for-fraction-field-elements/?answer=60860#post-id-60860