Integration in Terms of Exponential Integrals and Incomplete Gamma Functions
Total Page:16
File Type:pdf, Size:1020Kb
Integration in terms of exponential integrals and incomplete gamma functions Waldemar Hebisch Wrocªaw University [email protected] 13 July 2016 Introduction What is FriCAS? I FriCAS is an advanced computer algebra system I forked from Axiom in 2007 I about 30% of mathematical code is new compared to Axiom I about 200000 lines of mathematical code I math code written in Spad (high level strongly typed language very similar to FriCAS interactive language) I runtime system currently based on Lisp Some functionality added to FriCAS after fork: I several improvements to integrator I limits via Gruntz algorithm I knows about most classical special functions I guessing package I package for computations in quantum probability I noncommutative Groebner bases I asymptotically fast arbitrary precision computation of elliptic functions and elliptic integrals I new user interfaces (Emacs mode and Texmacs interface) FriCAS inherited from Axiom good (probably the best at that time) implementation of Risch algorithm (Bronstein, . ) I strong for elementary integration I when integral needed special functions used pattern matching Part of motivation for current work came from Rubi testsuite: Rubi showed that there is a lot of functions which are integrable in terms of relatively few special functions. I Adapting Rubi looked dicult I Previous work on adding special functions to Risch integrator was widely considered impractical My conclusion: Need new algorithmic approach. Ex post I claim that for considered here class of functions extension to Risch algorithm is much more powerful than pattern matching. Informally Ei(u)0 = u0 exp(u)=u Γ(a; u)0 = u0um=k exp(−u) for a = (m + k)=k and −k < m < 0. Our extension is very natural: 1 0 log(x − x0) = x − x0 exp x x 0 ( − 0) Ei(x − x0) = x − x0 Exponential integral plays the same role for integrals containing exponential function as logarithm plays for rational functions! Incomplete Gamma functions is has related role: it allows integrating functions of form xk+m−1 exp(xk ). Simple examples integrate(exp(x)/x^2, x) −ex + x Ei (x) x Needs preprocessing (Hermite reduction) to see Ei term. integrate((x-1)*exp(x)/x^2, x) ex x Similar looking, but elementary. integrate(exp(x)/(x^2 - 2), x) p p 2 p Ei − 2 + x e 2 − Ei 2 + x p p 2 2 e 2 Single exponential and denominator irreducible over integers, but two Ei terms. x*exp(x^2)/(x^4-5) p p p 2 p p 5 Ei − 5 + x2 e 5 − 5 Ei 5 + x2 p 20 e 5 Similar, but relation between complex factors of denominator and Ei terms is more complicated. integrate(((x+1)*exp(x))/log(x*exp(x)), x) li (x ex ) This shows that result may appear as logarithmic integral. integrate(((x+1)*exp(x))/(x + log(x)), x) li (x ex ) This shows that system can perform necessary simplications. integrate(exp(-x^2+2*x), x) p e erf (x − 1) π 2 D(%, x) e e−x2+2 x−1 erf term with a shift. integrate((2*x+4)*exp(-x^2-2*x-1)/(x+1), x) p erf (x + 1) π + Ei −x2 − 2 x − 1 This shows that Ei and erf may be mixed together. integrate((1 + exp(x))*exp(exp(x)^2), x) p π er (ex ) + Ei ex 2 2 Similar, but no denominator to signal presence of Ei term. Also, we get er when appropriate. integrate(x^3*exp(-x^3), x) 1 3 −x3 −Γ 3 ; x − 3 x e 9 Gamma plus elementary part. integrate((x+1)*exp(-x^3-3*x^2-3*x), x) 2 3 2 e Γ 3 ; x + 3 x + 3 x + 1 − 3 Gamma with a shift. integrate(x^2*exp(-(x+1)^3), x) 2 3 2 1 3 2 −x3−3 x2−3 x−1 2 Γ 3 ; x + 3 x + 3 x + 1 − Γ 3 ; x + 3 x + 3 x + 1 − e 3 Single term in the input, two Gamma terms plus elementary part in the output. integrate(sin(x+1)/x^2, x) −2 sin (x + 1) − 2 x sin (1) Si (x) + x cos (1) Ci (x) + x cos (1) Ci (−x) 2 x Si and Ci terms with shift. integrate(x*sin(x^4), x) q fresnelS x2 2 π q 2 2 π can generate Fresnel integrals. integrate(exp(x + sqrt(x+1)), x) 5 p p x+1+x p 2 x+1+1 2 e 4 e − π er 2 5 2 e 4 we can handle some algebraics by cheating (change of variable). f := (2*x^4-x^3+3*x^2+2*x+2)*exp(x/(x^2+2))/(x^3+2*x) integrate(f, x) x x 2 2 x + 2 e x +2 + Ei x2 + 2 Hard to separate elementary and Ei part. Peek inside )trace INTEF )math integrate(sin(x^2), x) 1<enter ElementaryIntegration.lfintegrate,43 : 2 2 %i x - %i (%e ) + %i arg1= -------------------- 2 %i x 2%e arg2= x 1>exit ElementaryIntegration.lfintegrate,43 : +---+ | 2 fresnelS(x |--- ) \|%pi ----------------- +---+ | 2 |--- \|%pi Theoretical background If K is a dierential eld, v; u 2 K and v 0 = u0=u we say that u is exponential element and that v is logarithmic element. The set of exponential elements in K is an abelian group with respect to multiplication. The set of logarithmic elements in K is an abelian group with respect to addition. Main examples: I explicit exponential is exponential element I argument of logarithm is exponential element k I if a is an exponential element, then a is also an exponential element Example: If K = F (θ), θ is Lambert W over F , that is θ is transcendental and there exist z F such that 0 z0θ , then 2 θ = z(θ+1) θ=z is an exponential element in K and −θ is corresponding logarithmic element. Theorem If K is nitely generated dierential eld, then group of logarithmic elements modulo additive constants is a nite rank free abelian group. The same for group of exponential elements modulo multiplicative constants. In our elds we can eectively test if element is an exponential element and nd associated logarithmic element and vice versa. Gamma extensions We say that a dierential eld E is a gamma extension of F if there exists θ1; : : : ; θn 2 E such that E = F (θ1; : : : ; θn) and for each i, 1 ≤ i ≤ n, one of the following holds 1. θi is algebraic over Fi 0 θi 0 2. = u for some u 2 Fi θi 0 u0 3. θi = u for some u 2 Fi 0 u0 0 0 4. θi = v for some u; v 2 Fi such that u = v u 0 0 5. there are w; u; v 2 Fi and integers k; m such that θi = wu , u0 = v 0u, w k = v m, −k < m < 0. where Fi = F (θ1; : : : ; θi−i ). Liouville principle Let f 2 K(θ) where θ is a exponential or a primitive. Under appropriate technical assumptions, if f has integral in a Gamma extension of K(θ), then there is an algebraic extension K¯ of K such that v 0 u 0 X i X 0 i X 0 f = v0 + ci + ci vi + ci vi wi ui (1) vi vi i2I1 i2I2 i2I3 0 0 where ci 2 K are constants, ui = vi ui , vi 2 K(θ) for i 2 I2 [ I3, ui 2 K(θ) for i 2 I2, ui ; wi 2 K¯ (θ), wi ui 2 K(θ) for i 2 I3, ki mi wi = vi . The main case is integration of functions of form f θ where θ is an exponential. We get equation: u 0 X 0 i θ X 0 f θ = (gθ) + vi + vi wi ui θ vi i2I2 i2I3 0 0 where vi ui θ = (ui θ) . We will denote logarithm of θ as v, that is θ0 = v 0θ. Then we can write u 0 0 X 0 i X 0 f = g + v g + vi + vi wi ui (2) vi i2I2 i2I3 We will call terms of the sum over I2 Ei terms and terms of the sum over I3 gamma terms. Formula 2 generalises Risch dierential equation (RDE). Parametric RDE Problem: given fi ; u nd set of g; ci such that 0 X f0 = g + ug + ci fi and ci are constants. We assume availability of solver for parametric RDE. In generic case we need to nd nite number of candidates for possible Ei and gamma terms and use solver for parametric RDE. In few special cases we have innite number of candidate Ei or gamma terms and determine which terms actually occur during solving RDE. The following cases may appear: I regular Ei terms, depend only on denominator of f I special Ei terms, depend only on structure of dierential eld I innite family of Ei terms in case of v linear in logarithm I regular gamma terms, depend only on structure of dierential eld I innite families of gamma (erf) terms General setup Let be top transcendental in K and M be a dierential subeld such that K is algebraic over M( ). By assumption we can write vi = v + ri + ai where ai 2 M and ri 2 Q 6= 0 only when is a logarithm. When is not an exponential let S be integral closure of M[ ] in K. When is an exponential let S be integral closure of M[ ; −1]. (In general we put inverses of all special elements in S).