integrate(function, x) integrates a function with respect to the symbolic variable x. The program recognizes all built-in functions and polynomials:
Let us consider an example which shows the original function and its integral in a single 2D plot:
All trigonometric functions are also supported. Run this script to see the answer.
If function is rational (i.e. quotient of two polynomials, whose coefficients do not depend on x)) we use the standard approach: Separate a polynomial part, then separate a square free part using Horowitz'  method, and finally integrate the rest using partial fractions. The final terms are collected to avoid complex expressions.
Expressions of type and are detected:
Substitutions of type are applied:
Products are fed through partial integration. This solves all cases where is one of exp, sin , cos , log , atan.
All trig and exp-functions are normalized. This solves any expression, which is the product of any number and any type of exponentials and trigonometric functions, and some cases of rational expressions of trig- and exp-functions
The special case is implemented:
Clever substitutions may be supplied manually through subst(). If all fails, integrate numerically using quad or romberg. The symbolic variable may be omitted if it is the main variable of expression. Integration can be quickly verified using diff() on the result.