sage: K.<a,b> = ParametricRealField([2, 1])
sage: K.is_commutative()
True
sage: K.is_ring()
True
sage: K in CommutativeRings()
False
sage: R = PolynomialRing(K, 'x')
---------------------------------------------------------------------------
TypeError: Base ring <class '__main__.ParametricRealField'> must be a commutative ring.
How can I make K commutative?
sage: K in CommutativeRings()
True
However, sage: R.<x,y> = PolynomialRing(K) raises NotImplementedError.
I suspect that the _element_constructor_ method of the class ParametricRealField needs to be provided.
I tried the following in class ParametricRealField(Field):
sage: K.<a,b> = ParametricRealField([2, 1])
sage: R.<x,y> = PolynomialRing(K)
sage: x
---------------------------------------------------------------------------
TypeError: unsupported operand parent(s) for '*': '<class '__main__.ParametricRealField_with_category'>' and '<class '__main__.ParametricRealField_with_category'>'
<ipython-input-26-4f6c8185301c> in __init__(self, values, names)
4
5 def __init__(self, values=[], names=()):
----> 6 Field.__init__(self)
7 #self._element_class = ParametricRealFieldElement
8 self._zero_element = ParametricRealFieldElement(Integer(0), parent=self)
/Users/yzh/sage/src/sage/rings/ring.pyx in sage.rings.ring.IntegralDomain.__init__ (/Users/yzh/sage/src/build/cythonized/sage/rings/ring.c:13965)()
1539 _default_category = IntegralDomains()
1540
-> 1541 def __init__(self, base_ring, names=None, normalize=True, category=None):
1542 """
1543 Initialize ``self``.
TypeError: __init__() takes at least 1 positional argument (0 given)