# 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!

edit retag close merge delete

1

What about using S.<a> = PolynomialRing(R.fraction_field()) ?

( 2021-09-08 13:20:07 +0100 )edit

The coefficient (2*k+1)/(k-1) is not a polynomial but a rational function in k. 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.

( 2021-09-09 15:56:09 +0100 )edit

Sort by » oldest newest most voted

We tried a bit more and it turns out that dividing by a small irreducible polynomial will actually work:

sturm(((2*k+1) *a + 1)/(k^2+1))
=> [((2*k + 1)/(k^2 + 1))*a + 1/(k^2 + 1), (2*k + 1)/(k^2 + 1)]


The spurious factor cannot change the number of sign changes, so that's a workaround.

more