Ask Your Question

Sturm polynomials with polynomial coefficients. How?

asked 2021-09-08 08:51:15 +0200

vigna gravatar image

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 flag offensive close merge delete



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

FrédéricC gravatar imageFrédéricC ( 2021-09-08 13:20:07 +0200 )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.

Max Alekseyev gravatar imageMax Alekseyev ( 2021-09-09 15:56:09 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-09-08 09:31:55 +0200

vigna gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-09-08 08:51:15 +0200

Seen: 175 times

Last updated: Sep 08 '21