symtegration-0.6.1: Library for symbolic integration of mathematical expressions.
CopyrightCopyright 2025 Yoo Chung
LicenseApache-2.0
Maintainerdev@chungyc.org
Safe HaskellSafe-Inferred
LanguageGHC2021

Symtegration.Integration.Monomial

Description

Supports the integration of functions in a monomial extension. Specifically, for a differential field \(k\) with a monomial extension \(k(t)\), attempts to derive an integral for functions of the form

\[ f(t) = \frac{a(t)}{d(t)} \]

where \(t\) is a monomial over \(k\), and \(a\) and \(f\) are polynomials of \(t\). Here, a monomial \(t\) with respect to a derivation \(D\) refers to a transcendental over \(k\) for which \(Dt\) is a polynomial of \(t\). For example, \(t = \tan x\) is a monomial over the real numbers with respect to \(D=\frac{d}{dx}\), since \(\tan x\) is transcendental and \(Dt = t^2 + 1\). It does not mean a polynomial with only one term such as \(c x^n\).

A function is simple with respect to a derivation \(D\) if it has a denominator \(d\) which is normal, i.e., \(\gcd(d, Dd) = 1\). A function is reduced with respect to a derivation \(D\) if it has a denominator \(d\) which is special, i.e., \(\gcd(d, Dd) = d\).

Synopsis

Documentation

hermiteReduce Source #

Arguments

:: (Polynomial p e c, Eq (p e c), Num (p e c), Eq c, Fractional c) 
=> (p e c -> p e c)

Derivation \(D\).

-> Function (p e c)

Function \(f\).

-> ([Function (p e c)], Function (p e c), Function (p e c))

Hermite reduction \((g, h, r)\) of \(f\).

Hermite reduction for a function in a monomial extension.

Specifically, for derivation \(D\) and function \(f\), returns \(g\), \(h\), and \(r\) such that

\[ f = Dg + h + r \]

where \(h\) is simple and \(r\) is reduced.

For example, with derivation \(D\) and monomial \(t\) such that \(Dt = t^2 + 1\), it is the case that \(\frac{t^4 + t + 1}{t^2} = Dg + h + r\), where \(g = -\frac{1}{t}\), \(h = \frac{1}{t}\), and \(r = t^2 - 1\).

>>> let deriv = extend (const 0) (power 2 + 1 :: IndexedPolynomial)
>>> hermiteReduce deriv $ fromPolynomials (power 4 + power 1 + 1) (power 2)
([Function ((-1)) (x)],Function (1) (x),Function (x^2 + (-1)) (1))

Since it is the case that \(\frac{dt}{dx} = t^2 + 1\) for \(t = \tan x\), this implies that

\[ \int \frac{\tan^4 x + \tan x + 1}{\tan^2 x} \, dx = -\frac{1}{\tan x} + \int \left( \frac{1}{\tan x} + \tan^2 x - 1\right) \, dx \]

\(g\) is returned as a list of functions which sum to \(g\) instead of a single function, because the former could sometimes be simpler to read.

polynomialReduce Source #

Arguments

:: (Polynomial p e c, Num (p e c), Fractional c) 
=> (p e c -> p e c)

Derivation \(D\).

-> p e c

Polynomial \(p\).

-> (p e c, p e c)

Polynomial reduction \((g, h)\).

Polynomial reduction in a monomial extension with the given derivation and polynomial. Specifically, for derivation \(D\) and polynomial \(p\), returns polynomials \(g\) and \(h\) such that

\[ p = Dg + h \]

where the degree of \(h\) is less than the degree of \(Dt\), if the latter is larger than 0.

For example, with derivation \(D\) such that \(Dt = t^2 + 1\), it is the case that \(3t^4 + 3t^3 + 4 = D\left( t^3 + \frac{3}{2}t^2 - 3t \right) - 3t + 7\).

>>> let derivation = extend (const 0) (power 2 + 1 :: IndexedPolynomial)
>>> polynomialReduce derivation $ 3 * power 4 + 3 * power 3 + 4
(x^3 + (3 % 2)x^2 + (-3)x,(-3)x + 7)

residueReduce Source #

Arguments

:: (Polynomial p e c, Eq (p e c), Num (p e c), Polynomial p e (p e c), Eq (p e (p e c)), Num (p e (p e c)), Polynomial p e (Function (p e c)), Eq (p e (Function (p e c))), Num (p e (Function (p e c))), Eq c, Fractional c) 
=> (p e c -> p e c)

Derivation \(D\).

-> Function (p e c)

Function \(f\).

-> Maybe ([(p e c, p e (p e c))], Bool)

Logarithmic terms \((s_i, S_i)\) and whether an elementary integral for \(\int f \, dx\) exists.

Resultant reduction of a simple function in a monomial extension.

Specifically, for a derivation \(D\) on \(k(t)\) and a simple function \(f \in k(t)\), returns logarithmic terms \((s_i, S_i)\) such that

\[ g = \sum_i \sum_{\alpha \mid s_i(\alpha) = 0} \alpha \log S_i(\alpha, t) \]

and also whether \(f\) has an elemantary integral. If \(f\) has an elementary integral, then there is a polynomial \(h\) of the monomial \(t\) such that \(f - Dg = h\).

For example, for derivation \(D=\frac{d}{dx}\) and simple function \(f = \frac{t^2+2t+1}{t^2-t+1}\),

>>> residueReduce differentiate $ fromPolynomials (power 2 + 2 * power 1 + 1) (2 * power 2 - 2 * power 1 - 1 :: IndexedPolynomial)
Just ([(x^2 + ((-3) % 2)x + ((-3) % 16),[(0,(4 % 9)x + (1 % 3)),(1,((-8) % 9)x + (2 % 3))])],True)

so that

\[ g = \sum_{\alpha \mid \alpha^2-\frac{3}{2}\alpha-\frac{3}{16} = 0} \log \left( (\frac{2}{3}-\frac{8}{9}\alpha)t + \frac{4}{9}\alpha+\frac{1}{3} \right) \]

and \(\int f \, dx\) has an elementary integral, which happens to be

\[ \int f \, dx = g + \int h \, dx \]

where \(h = f-Dg\) is a polynomial of the monomial \(t\).