SymbolicIntegration.jl solves indefinite integrals using one of the implemented algorithms: Risch method and Rule based method
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.
julia> using Pkg; Pkg.add("SymbolicIntegration") # installation
julia> using SymbolicIntegration, Symbolics
julia> @variables x
1-element Vector{Num}:
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 RischMethod will be tried, then RuleBasedMethod:
julia> integrate(sqrt(x))
┌ Warning: NotImplementedError: integrand contains unsupported expression sqrt(x)
└ @ SymbolicIntegration ~/.julia/dev/SymbolicIntegration.jl_official/src/methods/risch/frontend.jl:826
> RischMethod failed returning ∫(sqrt(x), x)
> Trying with RuleBasedMethod...
(2//3)*(x^(3//2))
julia> integrate(abs(x))
┌ Warning: NotImplementedError: integrand contains unsupported expression abs(x)
└ @ SymbolicIntegration ~/.julia/dev/SymbolicIntegration.jl_official/src/methods/risch/frontend.jl:826
> RischMethod failed returning ∫(abs(x), x)
> Trying with RuleBasedMethod...
No rule found for ∫(abs(x), x)
> RuleBasedMethod failed returning ∫(abs(x), x)
> Sorry we cannot integrate this expression :(
Currently two algorithms 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 | ❌ | ❌ |
more than one symbolic variable in the expression |
❌ | ✅ |
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.
Complete documentation with method selection guidance, algorithm details, and examples is available at: docs.sciml.ai/SymbolicIntegration
If you use SymbolicIntegration.jl in your research, please cite:
@software{SymbolicIntegration.jl,
author = {Harald Hofstätter and Mattia Micheletta Merlin and Chris Rackauckas},
title = {SymbolicIntegration.jl: Symbolic Integration for Julia},
url = {https://github.com/JuliaSymbolics/SymbolicIntegration.jl},
year = {2023-2025}
}