SymbolicIntegration.jl solves indefinite integrals (find primitives of functions) using one of the implemented algorithms: Risch method and Rule based method
julia> using SymbolicIntegration, Symbolics
julia> @variables x
julia> integrate(exp(2x) + 2x^2 + sin(x))
(1//2)*exp(2x) + (2//3)*(x^3) - cos(x)The first argument is the expression to integrate, second argument is the variable of integration. If the variable is not specified, it will be guessed from the expression. The +c is omitted :)
You can explicitly choose a integration method like this:
risch = RischMethod(use_algebraic_closure=true, catch_errors=false)
integrate(f, x, risch)or like this:
rbm = RuleBasedMethod(verbose=true, use_gamma=false)
integrate(f, x, rbm)If no method is specified, first RuleBasedMethod will be tried, then RischMethod:
julia> integrate(abs(x);verbose=true)
No rule found for ∫(abs(x), x)
> RuleBasedMethod(use_gamma=false, verbose=false) failed, returning ∫(abs(x), x)
> Trying with RischMethod(use_algebraic_closure=false, catch_errors=true)...
┌ Warning: NotImplementedError: integrand contains unsupported expression abs(x)
└ @ SymbolicIntegration ~/.julia/dev/SymbolicIntegration.jl_official/src/methods/risch/frontend.jl:821
> RischMethod(use_algebraic_closure=false, catch_errors=true) failed, returning ∫(abs(x), x)
> Sorry we cannot integrate this expression :(
For information on using the package, see the stable documentation. Use the in-development documentation for the version of the documentation which contains the unreleased features.
Currently two methods are implemented: Risch algorithm and Rule based integration.
| feature | Risch | Rule based |
|---|---|---|
| rational functions | ✅ | ✅ |
| non integers powers | ❌ | ✅ |
| exponential functions | ✅ | ✅ |
| logarithms | ✅ | ✅ |
| trigonometric functions | ? | sometimes |
| hyperbolic functions | ✅ | sometimes |
| Nonelementary integrals | ❌ | most of them |
| Special functions | ❌ | ❌ |
| multiple symbols | ❌ | ✅ |
More info about them in the methods documentation
Complete symbolic integration using the Risch algorithm from Manuel Bronstein's "Symbolic Integration I: Transcendental Functions".
This method uses a large number of integration rules that specify how to integrate various mathematical expressions. There are now more than 3400 rules impelmented.
If you use SymbolicIntegration.jl in your research, please cite:
@software{SymbolicIntegration.jl,
author = {Mattia Micheletta Merlin, Harald Hofstätter and Chris Rackauckas},
title = {SymbolicIntegration.jl: Symbolic Integration for Julia},
url = {https://github.com/JuliaSymbolics/SymbolicIntegration.jl},
year = {2023-2025}
}