#7882·sympy

weak_normalizer applies wrong multiplicities

Author: jksuomCreated Aug 17, 2014Updated Sep 30, 2026
Labelspolys

Given an element f of a differential field k(t), weak_normalizer aims to construct a polynomial q in k[t] whose roots are the simple poles of f having positive integer residues the multiplicity of the root being equal to the residue. Then Dq/q will have the same residues, so these poles will no longer exist in the difference f - Dq/q. This is not what happens.

from sympy import Poly
from sympy.integrals.risch import DifferentialExtension
from sympy.integrals.rde import weak_normalizer
from sympy.abc import x, t

DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(t, t)]})

a = Poly(1, t)
d = Poly(t - 1, t)
weak_normalizer(a, d, DE)

(Poly(t - 1, t, domain='ZZ'),
 (Poly(-1, t, domain='ZZ'), Poly(1, t, domain='ZZ')))

This is correct. a/d has a simple pole at t = 1 with residue 1/t = 1. q = t - 1 has a simple root at t = 1. No pole remains in the result.

a = Poly(2, t)
weak_normalizer(a, d, DE)

(Poly(t - 1, t, domain='ZZ'),
 (Poly(-t + 2, t, domain='ZZ'), Poly(t - 1, t, domain='ZZ')))

This is incorrect. The residue is 2 but we still get q = t - 1 with multiplicity 1. In the result t - 1 is left in the denominator.

a = Poly(-1, t)
d = Poly(t + 1, t)
weak_normalizer(a, d, DE)

(Poly(t + 1, t, domain='ZZ'),
 (Poly(-1, t, domain='ZZ'), Poly(1, t, domain='ZZ')))

This is correct. a/d has the residue -1/t = 1 at t = -1. q = t + 1 has a simple zero and the result has no pole.

a = Poly(2, t)
d = Poly(t**2 - 1, t)
weak_normalizer(a, d, DE)

(Poly(t**4 - 2*t**2 + 1, t, domain='ZZ'),
 (Poly(-4*t**2 + 2, t, domain='ZZ'), Poly(t**2 - 1, t, domain='ZZ')))

2/(t^2 - 1) = 1/(t-1) - 1/(t+1) has two simple poles with residue 1. However, q = (t^2 - 1)^2 has two double zeroes. t^2 - 1 remains in the denominator of the result. (The result is actually weakly normalized though not what was expected as the residues are now 1 - 2 = -1.)

These examples show what is going on. The multiplicities of the roots of q are not determined by the residues but by the number of poles with the same residue value. The residues are the zeroes of the Rothstein-Trager resultant, and real_roots lists them with multiplicities. real_roots should be replaced with a method that only produces one copy of each root. The corresponding multiplicity is then the residue.