Ask Your Question

Revision history [back]

PolynomialRing and from __future__ import unicode_literals

Hello

sage: from __future__ import unicode_literals
sage: R=PolynomialRing(QQ,'x')

TypeError Traceback (most recent call last)

/home/moky/script/<ipython console=""> in <module>()

/home/moky/Sage/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_ring_constructor.pyc in PolynomialRing(base_ring, arg1, arg2, sparse, order, names, name, implementation) 425 if R is None: 426 raise TypeError("invalid input (%s, %s, %s) to PolynomialRing function; please see the docstring for that function"%( --> 427 base_ring, arg1, arg2)) 428 429 return R

TypeError: invalid input (Rational Field, x, None) to PolynomialRing function; please see the docstring for that function

I guess this is the same kind of problem that the one in this question

PolynomialRing and from __future__ import unicode_literals

Hello

sage: from __future__ import unicode_literals
sage: R=PolynomialRing(QQ,'x')

TypeError Traceback (most recent call last)

/home/moky/script/<ipython console=""> in <module>()

/home/moky/Sage/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_ring_constructor.pyc in PolynomialRing(base_ring, arg1, arg2, sparse, order, names, name, implementation) 425 if R is None: 426 raise TypeError("invalid input (%s, %s, %s) to PolynomialRing function; please see the docstring for that function"%( --> 427 base_ring, arg1, arg2)) 428 429 return R

TypeError: invalid input (Rational Field, x, None) to PolynomialRing function; please see the docstring for that function

I guess this is the same kind of problem that the one in this question

By the way, this is "fixed" by using str :

sage: R=PolynomialRing(QQ,str('x'))
sage: f=R.lagrange_polynomial([(0,1),(1,4)]);f
3*x + 1