Skip to content

Commit 2c0c425

Browse files
committed
improved documentation
1 parent a5419e9 commit 2c0c425

File tree

10 files changed

+301
-280
lines changed

10 files changed

+301
-280
lines changed

README.md

Lines changed: 26 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,52 @@
22

33
[![Build Status](https://github.com/JuliaSymbolics/SymbolicIntegration.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaSymbolics/SymbolicIntegration.jl/actions/workflows/CI.yml?query=branch%3Amain)
44
[![Spell Check](https://github.com/JuliaSymbolics/SymbolicIntegration.jl/actions/workflows/spellcheck.yml/badge.svg?branch=main)](https://github.com/JuliaSymbolics/SymbolicIntegration.jl/actions/workflows/spellcheck.yml)
5+
[![Rules](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/JuliaSymbolics/SymbolicIntegration.jl/main/.github/badges/rules-count.json&query=$.message&label=Total%20rules&color=blue)](https://github.com/JuliaSymbolics/SymbolicIntegration.jl)
56

67

7-
SymbolicIntegration.jl provides a flexible, extensible framework for symbolic integration with multiple algorithm choices.
8+
SymbolicIntegration.jl solves indefinite integrals using one of the implemented algorithms: Risch method and Rule based method
89

910

1011
# Usage
11-
12-
### Installation
1312
```julia
14-
julia> using Pkg; Pkg.add("SymbolicIntegration")
15-
```
16-
17-
### Basic Integration
13+
julia> using Pkg; Pkg.add("SymbolicIntegration") # installation
1814

19-
```julia
2015
julia> using SymbolicIntegration, Symbolics
2116

2217
julia> @variables x
2318
1-element Vector{Num}:
2419
x
2520

26-
julia> integrate(x^2,x)
27-
(1//3)*(x^3)
28-
29-
julia> integrate(x+x^2)
30-
(1//2)*(x^2) + (1//3)*(x^3)
31-
21+
julia> integrate(exp(2x) + 2x^2 + sin(x))
22+
(1//2)*exp(2x) + (2//3)*(x^3) - cos(x)
3223
```
3324
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 :)
3425

3526
### Method Selection
3627

3728
You can explicitly choose a integration method like this:
3829
```julia
39-
# Explicit method choice
4030
risch = RischMethod(use_algebraic_closure=true, catch_errors=false)
4131
integrate(f, x, risch)
4232
```
43-
or
33+
or like this:
4434
```julia
4535
rbm = RuleBasedMethod(verbose=true, use_gamma=false)
4636
integrate(f, x, rbm)
4737
```
4838

4939
If no method is specified, first RischMethod will be tried, then RuleBasedMethod:
5040
```julia
51-
julia> integrate(2x)
52-
x^2
53-
5441
julia> integrate(sqrt(x))
5542
┌ Warning: NotImplementedError: integrand contains unsupported expression sqrt(x)
5643
└ @ SymbolicIntegration ~/.julia/dev/SymbolicIntegration.jl_official/src/methods/risch/frontend.jl:826
5744

5845
> RischMethod failed returning (sqrt(x), x)
5946
> Trying with RuleBasedMethod...
6047

61-
-------Applied rule 1_1_1_1_2 on (sqrt(x), x)
62-
| (x ^ m, x) => if
63-
| !(contains_var(m, x)) &&
64-
| !(eq(m, -1))
65-
| x ^ (m + 1) / (m + 1)
66-
-------with result: (2//3)*(x^(3//2))
6748
(2//3)*(x^(3//2))
68-
49+
```
50+
```julia
6951
julia> integrate(abs(x))
7052
┌ Warning: NotImplementedError: integrand contains unsupported expression abs(x)
7153
└ @ SymbolicIntegration ~/.julia/dev/SymbolicIntegration.jl_official/src/methods/risch/frontend.jl:826
@@ -84,28 +66,26 @@ No rule found for ∫(abs(x), x)
8466
# Integration Methods
8567
Currently two algorithms are implemented: **Risch algorithm** and **Rule based integration**.
8668
87-
## Risch Method
69+
feature | Risch | Rule based
70+
--------|-------|-----------
71+
rational functions | ✅ | ✅
72+
non integers powers | ❌ | ✅
73+
exponential functions | ✅ | ✅
74+
logarithms | ✅ | ✅
75+
trigonometric functions | ? | sometimes
76+
hyperbolic functions | ✅ | sometimes
77+
Nonelementary integrals | ❌ | most of them
78+
Special functions | ❌ | ❌
79+
more than one symbolic<br> variable in the expression | ❌ | ✅
80+
81+
More info about them in the [methods documentation](methods/overview.md)
82+
83+
### Risch Method
8884
Complete symbolic integration using the Risch algorithm from Manuel Bronstein's "Symbolic Integration I: Transcendental Functions".
8985
90-
**Capabilities:**
91-
- ✅ **Rational functions**: Complete integration with Rothstein-Trager method
92-
- ✅ **Transcendental functions**: Exponential, logarithmic using differential field towers
93-
- ✅ **Complex roots**: Exact arctangent terms for complex polynomial roots
94-
- ✅ **Integration by parts**: Logarithmic function integration
95-
- ✅ **Trigonometric functions**: Via transformation to exponential form
96-
- ❌ **More than one symbolic variable**: Integration w.r.t. one variable, with other symbolic variables present in the expression
97-
98-
## RuleBasedMethod
99-
100-
[![Rules](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/JuliaSymbolics/SymbolicIntegration.jl/main/.github/badges/rules-count.json&query=$.message&label=Total%20rules&color=blue)](https://github.com/JuliaSymbolics/SymbolicIntegration.jl)
101-
102-
This method uses a rule based approach to integrate a vast class of functions, and it's built using the rules from the Mathematica package [RUBI](https://rulebasedintegration.org/).
103-
104-
**Capabilities:**
105-
- ✅ Fast convergence for a large base of recognized cases
106-
- ✅ Algebraic functions like `sqrt` and non-integer powers are supported
107-
- ✅ **More than one symbolic variable**: Integration w.r.t. one variable, with other symbolic variables present in the expression
86+
### RuleBasedMethod
10887
88+
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.
10989
11090
# Documentation
11191
@@ -119,7 +99,7 @@ If you use SymbolicIntegration.jl in your research, please cite:
11999
120100
```bibtex
121101
@software{SymbolicIntegration.jl,
122-
author = {Harald Hofstätter and Mattia Micheletta Merlin},
102+
author = {Harald Hofstätter and Mattia Micheletta Merlin and Chris Rackauckas},
123103
title = {SymbolicIntegration.jl: Symbolic Integration for Julia},
124104
url = {https://github.com/JuliaSymbolics/SymbolicIntegration.jl},
125105
year = {2023-2025}

docs/src/index.md

Lines changed: 31 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ using SymbolicIntegration, Symbolics
1919

2020
@variables x a
2121

22-
# Basic polynomial integration (uses default RischMethod)
22+
# Basic polynomial integration
2323
integrate(x^2, x) # Returns (1//3)*(x^3)
2424

2525
# Rational function integration
@@ -39,62 +39,47 @@ integrate(f, x, RischMethod(use_algebraic_closure=true)) # With options
3939

4040
## Integration Methods
4141

42-
SymbolicIntegration.jl provides multiple integration algorithms through a flexible method dispatch system:
42+
SymbolicIntegration.jl provides two integration algorithms: Rule based and Risch method. Here is a quick table to see what they can integrate:
4343

44-
### RischMethod
45-
The complete Risch algorithm for elementary function integration:
46-
- **Exact results**: Guaranteed correct symbolic integration
47-
- **Complex roots**: Produces exact arctangent terms
48-
- **Complete coverage**: Rational and transcendental functions
49-
- **Configurable**: Options for performance vs completeness
50-
51-
```julia
52-
# Default method
53-
integrate(f, x)
54-
55-
# Explicit method with options
56-
integrate(f, x, RischMethod(use_algebraic_closure=true))
57-
```
44+
feature | Risch | Rule based
45+
--------|-------|-----------
46+
rational functions | ✅ | ✅
47+
non integers powers | ❌ | ✅
48+
exponential functions | ✅ | ✅
49+
logarithms | ✅ | ✅
50+
trigonometric functions | ? | sometimes
51+
hyperbolic functions | ✅ | sometimes
52+
Nonelementary integrals | ❌ | most of them
53+
Special functions | ❌ | ❌
54+
more than one symbolic<br> variable in the expression | ❌ | ✅
5855

59-
Is implemented in a generic way using [AbstractAlgebra.jl](https://nemocas.github.io/AbstractAlgebra.jl/dev/). Some algorithms require [Nemo.jl](https://nemocas.github.io/Nemo.jl/dev/) for calculations with algebraic numbers.
56+
[→ See complete methods documentation](methods/overview.md)
6057

61-
Is based on the algorithms from the book:
58+
### RischMethod
59+
This method is based on the algorithms from the book:
6260

6361
> Manuel Bronstein, [Symbolic Integration I: Transcentental Functions](https://link.springer.com/book/10.1007/b138171), 2nd ed, Springer 2005,
6462
65-
for which a pretty complete set of reference implementations is provided.
63+
for which a pretty complete set of reference implementations is provided. As in the book, integrands involving algebraic functions like `sqrt` and non-integer powers are not treated.
6664

67-
Currently, RischMethod can integrate:
68-
- Rational functions
69-
- Integrands involving transcendental elementary functions like `exp`, `log`, `sin`, etc.
70-
71-
As in the book, integrands involving algebraic functions like `sqrt` and non-integer powers are not treated.
65+
```julia
66+
integrate(x^2 + 1, x, RischMethod(use_algebraic_closure=false, catch_errors=true))
67+
```
68+
- `use_algebraic_closure` does what?
69+
- `catch_errors` does what?
7270

73-
!!! note
74-
SymbolicIntegration.jl is still in an early stage of development and should not be expected to run stably in all situations.
75-
It comes with absolutely no warranty whatsoever.
71+
[→ See detailed Risch documentation](risch.md)
7672

7773
### RuleBased
78-
TODO add
79-
80-
[→ See complete methods documentation](methods/overview.md)
81-
82-
## Algorithm Coverage
74+
This method uses a large number of integration rules that specify how to integrate various mathematical expressions.
8375

84-
The **RischMethod** implements the complete suite of algorithms from Bronstein's book:
85-
86-
- **Rational Function Integration** (Chapter 2)
87-
- Hermite reduction
88-
- Rothstein-Trager method for logarithmic parts
89-
- Complexification and real form conversion
90-
91-
- **Transcendental Function Integration** (Chapters 5-6)
92-
- Risch algorithm for elementary functions
93-
- Differential field towers
94-
- Primitive and hyperexponential cases
76+
```julia
77+
integrate(x^2 + 1, x, RuleBasedMethod(verbose=true, use_gamma=false))
78+
```
79+
- `verbose` specifies whether to print or not the integration rules applied (default true)
80+
- `use_gamma` specifies whether to use rules with the gamma function in the result, or not (default false)
9581

96-
- **Algebraic Function Integration** (Future work)
97-
- Currently not implemented
82+
[→ See detailed Rule based documentation](methods/rulebased.md)
9883

9984
## Contributing
10085

@@ -106,7 +91,7 @@ If you use SymbolicIntegration.jl in your research, please cite:
10691

10792
```bibtex
10893
@software{SymbolicIntegration.jl,
109-
author = {Harald Hofstätter and contributors},
94+
author = {Harald Hofstätter and Mattia Micheletta Merlin and Chris Rackauckas},,
11095
title = {SymbolicIntegration.jl: Symbolic Integration for Julia},
11196
url = {https://github.com/JuliaSymbolics/SymbolicIntegration.jl},
11297
year = {2023-2025}

docs/src/manual/basic_usage.md

Lines changed: 0 additions & 119 deletions
This file was deleted.

docs/src/manual/contributing.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
- [Contributing to improving RuleBasedMethod](#contributing-to-improving-rulebasedmethod)
2+
- [Common problems when translating rules](#common-problems-when-translating-rules)
3+
- [function not translated](#function-not-translated)
4+
- [Sum function translation](#sum-function-translation)
5+
- [Module syntax translation](#module-syntax-translation)
6+
- [\* not present or present as \[Star\]](#-not-present-or-present-as-star)
7+
- [Description of the script `src/translator_of_rules.jl`](#description-of-the-script-srctranslator_of_rulesjl)
8+
- [How to use it](#how-to-use-it)
9+
- [How it works internally (useful to know if you have to debug it)](#how-it-works-internally-useful-to-know-if-you-have-to-debug-it)
10+
- [With syntax](#with-syntax)
11+
- [replace and smart\_replace applications](#replace-and-smart_replace-applications)
12+
- [Pretty indentation](#pretty-indentation)
13+
- [end](#end)
14+
- [Adding Testsuites](#adding-testsuites)
115

216
# Contributing to improving RuleBasedMethod
317

@@ -154,3 +168,6 @@ applied automatically that rewrites the rule like this:
154168
#### end
155169
finally the rule is placed in a tuple (index, rule), and all the
156170
tuples are put into a array, ready to be included by load_rules
171+
172+
## Adding Testsuites
173+
There is a test suite of 27585 solved integrals taken from the RUBI package, in the folders `test/test_files/0 Independent test suites` (1796 tests) and `test/test_files/1 Algebraic functions` (25798 tests). But more test can be translated from the [RUBI testsuite](https://rulebasedintegration.org/testProblems.html). In [this](https://github.com/Bumblebee00/SymbolicIntegration.jl?tab=readme-ov-file#testing) repo there are the tests still in Mathematica syntax and a script to transalte them to julia.

0 commit comments

Comments
 (0)