Sturm polynomials with polynomial coefficients. How?
We are stuck with the following problem: we want Sage to compute Sturm polynomials for a polynomial with coefficients in a field of rational functions. As long as the coefficients are actually functions, no problem:
R.<k> = PolynomialRing(QQ)
S.<a> = PolynomialRing(R)
sturm((2*k+1)/(k-1) *a + 1)
=> [((2*k + 1)/(k - 1))*a + 1, (2*k + 1)/(k - 1)]
The problem is that unless the coeffients are actual functions, Sage refuses to do it:
R.<k> = PolynomialRing(QQ)
S.<a> = PolynomialRing(R)
sturm((2*k+1) *a + 1)
=> [...
~/Applications/SageMath/local/lib/python3.9/site-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial_generic_dense.quo_rem (build/cythonized/sage/rings/polynomial/polynomial_element.c:94403)()
11434 q = R(q)
11435 except TypeError:
> 11436 raise ArithmeticError("division non exact (consider coercing to polynomials over the fraction field)")
11437 for j from n+k-2 >= j >= k:
11438 x[j] -= q * y[j-k]
ArithmeticError: division non exact (consider coercing to polynomials over the fraction field)
We tried several way to coerce, with no success. Suggestions welcome!
What about using
S.<a> = PolynomialRing(R.fraction_field())
?The coefficient
(2*k+1)/(k-1)
is not a polynomial but a rational function ink
. So, "polynomial coefficients" are irrelevant here and the base ring should be a fraction field (not a polynomial ring) as FrédéricC suggested above.