Return degree of polynomial in InfinitePolynomialRing
Consider the following:
sage: R.<a> = InfinitePolynomialRing(QQ)
sage: p = a[1]*a[2]^2
Then we have
sage: p.degree(a[1].variable())
1
sage: p.degree(a[2].variable())
2
but
sage: p.degree(a[3].variable())
...
TypeError: argument is not coercible to the parent
instead of returning 0
. Moreover, if I execute one of the commands that worked before again, for example p.degree(a[1].variable())
, it yields the same error. How can I solve this?