Ask Your Question
1

reduce() for fraction field elements

asked 2022-01-28 17:06:38 +0200

AShah gravatar image

updated 2022-01-29 09:22:49 +0200

slelievre gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-01-28 23:35:02 +0200

rburing gravatar image

updated 2022-01-28 23:38:37 +0200

See the documentation of 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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2022-01-28 17:06:38 +0200

Seen: 164 times

Last updated: Jan 29 '22