Ask Your Question

Revision history [back]

Both definitions of K are valid when x is a generator of a polynomial ring (or symbolic).

The error says that __pow__ is not implemented, because (in this case) your x is somehow an element of a free module, so it doesn't make sense to raise it to a power.

So you must have used the name x for something else. So don't do that and/or (re)define it as x = polygen(QQ) or R.<x> = QQ[] or R.<x> = PolynomialRing(QQ) (or var('x') to make it symbolic), etc.