Ask Your Question
2

Coercion and Laurent polynomial

asked 2016-06-02 20:11:36 +0100

Arnaud1418 gravatar image

Hi! Is there a simple way to make easy coercion from Symbolic Ring to Laurent polynomial ring (or even algebraic extension)? I've only been able to bypass the problem by the following trick (and due the amount of time I've spent on this I'm happy to share it!) :

# Polynomial in the Symbolic Ring
var('t')
P = t^3 + 1/10*t + 3*t^-1

# Laurent polynomial     
ringS.<t> = LaurentPolynomialRing(QQ)  

#PP = ringS(P)  # Not working
PP = ringS(sage_eval(str(P),locals={'t':t}))

print P, P.parent()
print PP, PP.parent()
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-06-06 19:40:20 +0100

FrédéricC gravatar image

Like that

sage: var('t')
sage: P = t^3 + 1/10*t + 3*t^-1; P
t^3 + 1/10*t + 3/t
sage: rng = LaurentPolynomialRing(QQ,'t')
sage: rng(P.numerator())/rng(P.denominator())
3*t^-1 + 1/10*t + t^3
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

1 follower

Stats

Asked: 2016-06-02 20:11:36 +0100

Seen: 689 times

Last updated: Jun 06 '16