We worked on Parametric logarithmic derivative PR #12885 only this week. So now I will get to a few mathematical points regarding the problem of “parametric logarithmic derivative” problem (will shortly write it as PLD problem).

The PLD problem is, for a given hyperexponential monomial $\theta$ over a differential field $K$ and $f \in K$, to decide whether there exists $n, m \in \mathbb{Z}$ with $n \neq 0$, for the equation: $nf = \frac{Dv}{v} + m\frac{D\theta}{\theta}$, and to find one such solution.

There are two versions of it, the first one being the heursitic version which is quite simple (with available pseudo code) and is already implemented in SymPy, but since it doesn’t handle all the cases, it becomes necessary to have the deterministic version of it. The deterministic version is sort of used as a fallback i.e in case the heuristic version fails (raises NotImplementedError) which isn’t quite often.

We already have done the basic programming of it in SymPy, so before I say any further let’s see an example.

A simple example of where the heuristic version fails is:

>>> fa, fd = Poly(1, x), Poly(1, x)
>>> wa, wd = Poly(1, x), Poly(1, x)
>>> DE = DifferentialExtension(extension={'D': [Poly(1, x, domain='ZZ'), Poly(t, t, domain='ZZ')], 'exts': [None, 'exp']})
>>> parametric_log_deriv_heu(fa, fd, wa, wd, DE)
None

# while the deterministic version, runs fine

>>> parametric_log_deriv(fa, fd, wa, wd, DE)
[Matrix([[-1, 1, 0]]), Matrix([[-1, 0, 1]])] # don't worry about output type



## Internals of deterministic version

In the deterministic version we use the Risch’s structure theorem, i.e

$\sum_{i \in \frac{L}{C(x)}} r_i Dt_i + \sum_{i \in \frac{E}{C(x)}} r_i \frac{Dt_i}{t_i} = f$ ( equation 1)

where we solve for each $r_i \in \mathbb{Q}$.

This result of structure theorem is quite useful, this same theorem can be used in the process of DifferentialExtension construction, as can be seen the section 5.2 in book (Outline and Scope of Integration Algorithm, search by section name if you have a different version of the book).

In PLD (deterministic) we first obtain the $Dt_i$ and $\frac{Dt_i}{t_i}$ parts depending on ‘log’/’exp’ extension respectively and store them in a list F (the order wouldn’t matter).

We reorganize this problem in a way somewhat similar to limited_integrate problem, i.e $f = Dv + c_1 w_1 + c_2 w_2 + \ldots + c_m w_m$ , we solve the problem $Dv + c_1 w_1 + c_2 w_2 + \ldots + c_m w_m + c_{m+1}f$ and chose the one where $c_{m + 1} = -1$.

The same thing we do here in this problem, but that does cause some problem as $f$ may not necesarily be contained in the extension $K(\theta)$, and currently we are working on solving this part of the problem, Kalevi suggests to take the unfinished DE object and the extension containing $f$ could be built on that.(No need to start from scratch.)

I haven’t mentioned much regarding the function that does the working for converting the relation in eq (1) over a field $K$ to one over $\mathbb{Q}$. It contains Poly manipulation methods to do that. It does mathematically the same thing as “to obtain a system with coefficients in C and the same constant solutions.”

I’ll complete the parametric_log_deriv before the next week starts.