First time here? Check out the FAQ!

Ask Your Question
1

reduce() for fraction field elements

asked 3 years ago

AShah gravatar image

updated 3 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 3 years ago

rburing gravatar image

updated 3 years ago

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.

Preview: (hide)
link

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: 3 years ago

Seen: 331 times

Last updated: Jan 29 '22