On basic integration techniques

This page explains the general integration techniques used by Symtegration which work in with direct integration methods. Together, they can integrate functions that the direct methods cannot integrate directly. For example, the Symtegration.Integration.Trigonometric module cannot integrate \(\sin \left(a x\right)\) by itself, but it can be integrated to \(-\frac{1}{a} \cos \left(a x\right)\) by using the Symtegration.Integration.Substitution module on top of the Symtegration.Integration.Trigonometric module.

See also more implementation notes on Symtegration.

Integrating with constant factors

The Symtegration.Integration.Term module can integrate a single additive term by separating out a constant factor, integrating the remaining factors, and then multiplying the constant factor with the integral.

\[\int a f \, dx = a \int f \, dx\]

Integrating by term

The Symtegration.Integration.Sum module integrates a sum by integrating each summand separately and adding the integrals together.

\[\int \left( \sum f_i \right) \, dx = \sum \left( \int f_i \, dx \right)\]

Integration by substitution

The Symtegration.Integration.Substitution module integrates by substitition.

If \(f' = \frac{df}{dx}\) and \(g' = \frac{dg}{dx}\), then by the chain rule we have

\[\frac{d f(g(x))}{dx} = g'(x) f'(g(x))\]

From this, it follows that

\[\int g'(x) f'(g(x)) \, dx = f(g(x))\]

If we have a function which is the multiplication of two other functions, we could try differentiating the argument to one of the functions to see if it is the same as the other function, and if so, we can integrate by substitution.

To get this to work, we need to be able to differentiate functions, for which we use AD. We also need to compare whether two separate representations of functions represent equivalent functions. This cannot always be done perfectly for arbitrary functions, but we can rewrite representations to make it more likely that equivalent functions have syntactically equal representations.

The variable multiplied by and added to a constant is a special case of integration by substitution, with \(g = ax+b\).

\[\int a f'(ax + b) \, dx = f(ax+b)\]

Integration by parts

The Symtegration.Integration.Parts module integrates by parts.

By the product rule, the derivative of the product of two functions \(f\) and \(g\) is as follows.

\[\frac{d(fg)}{dx} = g \frac{df}{dx} + f \frac{dg}{dx}\]

A minor rearrangement gives

\[g \frac{df}{dx} = \frac{d(fg)}{dx} - f \frac{dg}{dx}\]

If we know how to integrate \(f \frac{dg}{dx} \, dx\), then we can integrate \(g \frac{df}{dx} \, dx\).

\[\begin{align*} \int g \frac{df}{dx} \, dx & = \int \left( \frac{d(fg)}{dx} - f \frac{dg}{dx} \right) \, dx \\ & = \int \frac{d(fg)}{dx} \, dx - \int f \frac{dg}{dx} \, dx \\ & = f g - \int f \frac{dg}{dx} \, dx \end{align*}\]

If we are given a function \(F(x) G(x)\), we can try integrating this by guessing an \(f\) such that \(F = \frac{df}{dx}\), and hoping that \(\int f \frac{dG}{dx} \, dx\) is easier to integrate. If this does not work, we could try again with \(G\). Basically, we may be able to derive the integral of the original function from two easier integrals.