Wolfram developer gives an update on the development of integration functionality in Mathematica and the Wolfram Language based on advances in the field.
Category
Essays, Posts & Presentations
Keywords
Function Repository, New Technology, Wolfram Language
URL
http://www.notebookarchive.org/2022-01-9pman2g/
DOI
https://notebookarchive.org/2022-01-9pman2g
Date Added
2022-01-21
Date Last Modified
2022-01-21
File Size
282.54 kilobytes
Supplements
Rights
Redistribution rights reserved
Download
Open in Wolfram Cloud
New Methods for Computing Algebraic Integrals
August 18, 2021
Sam Blake, Algorithms R&D
In 2004, I became obsessed with computing integrals, using both elementary techniques known to calculus students and the Risch algorithm and its extensions by Davenport, Trager and Bronstein [1, 2, 3, 4, 5]. Taking inspiration from George Beck’s step-by-step differentiation program, WalkD, I decided to write a step-by-step program for computing indefinite integrals.
For example, it’s easy to write a simple set of replacement rules in Mathematica for integrating (expanded) polynomials:
After spending far too many late nights entering integration techniques as pattern-matching rules into Mathematica, I had the code at a reasonable state and I sent it to Wolfram Research for possible inclusion in Mathematica. Soon after, I was offered a job and ended up working for Wolfram for several years, predominantly on Wolfram|Alpha. My step-by-step integrator is still computing many integrals, some of which I have most likely forgotten how to do myself.
As an aside, the idea of using rule-based programming to compute indefinite integrals dates back to 1961, with the Symbolic Automatic Integrator (SAINT) by James Slagle at MIT. SAINT could solve “symbolic integration problems approximately at the level of a good college freshman and, in fact, uses many of the same methods (including heuristics) used by a freshman” [6]. The step-by-step integrator I wrote used around 350 rules and could integrate more than 99% of integrals in calculus textbooks. Since then, Albert Rich used Mathematica to create the Rule-based Integrator (Rubi), which uses over 6,700 rules.
Fast forward to 2020 and I hadn’t looked at integrals for a decade. I decided to see what advances had been made in the last 10 or so years. I was particularly interested in a Gröbner basis–based algorithm developed by Manuel Kauers and its extensions by Brian Miller that could seemingly outperform the algebraic case of the Risch algorithm in the AXIOM computer algebra system on many integrals [7, 8]. For example:
In[]:=
IntegrateKauers
12
x
+1
(
12
x
-1)
1/4
(
8
x
+1)
,x//Timing
Out[]=
0.276225,RootSum1+1296
4
#1
&,Log-x+6
1/4
(1+
8
x
)
#1#1&+
1
2
RootSum-1+2592
4
#1
&,Log-x+6
1/4
(1+
8
x
)
#1#1&,0
It’s trivial to check the result:
In[]:=
D[%[[-1,1]],x]-
12
x
+1
(
12
x
-1)
1/4
(
8
x
+1)
//Simplify
Out[]=
0
Once again, I quickly became hooked on integrals, or more specifically, algorithmic solutions to indefinite integrals.
When I last looked at symbolic integration, I was interested in the transcendental case of the Risch algorithm, of which Mathematica has a near-complete implementation. For example, the following is a simple integral for the transcendental case of the Risch algorithm:
In[]:=
Integrate
1+2x
x
+
1
x
-1
+
Log[x]
2
(1+
x
)
+
1-x-xLog[x]
(1+
x
)x
,x
Out[]=
Log[1-
x
]+Log[1+
x
]+Log[x]+
Log[x]
1+
x
I became more interested with algebraic integrals, which cannot be integrated with the transcendental Risch algorithm. The algebraic case of the Risch algorithm is considerably more complex than the transcendental case and has not been completely implemented in any computer algebra system.
I initially considered an algebraic integral that appears in many calculus textbooks:
2
x
-1
(
2
x
+1)
4
x
+1
x
.
If we’re happy to play it fast and loose with branch cuts, then we can write this integral as:
I wondered if this method of using a Laurent polynomial substitution to simplify an algebraic integral was just a trick that worked for this integral or a hint to a more general method. It turns out this trick works for many integrals; for example, the integral we tried previously on Kauers’s algorithm
12
x
+1
(
12
x
-1)
4
8
x
+1
x
can be reduced to
1
4
u-1
(u-2)(u+1)
4
u
u,
with the substitution
u=
4
x
+
-4
x
. Once corrected for branch cut issues, the solution is given by:
12
x
+1
(
12
x
-1)
4
8
x
+1
x=-
1
6
4
2
-1
tan
4
2
x
4
8
x
+1
-
1
3
2
-1
tan
2
x
4
8
x
+1
8
x
+1
-
2
x
-
1
6
4
2
-1
tanh
4
2
x
4
8
x
+1
-
1
3
2
-1
tanh
2
x
4
8
x
+1
2
x
+
8
x
+1
Ageneralmethodwouldseekasubstitutionoftheform
u=
n
∑
i=0
i
i
x
m
x
suchthat
∫
R
1
(x)
r(x)
x=∫
R
2
(u)
a
2
2
u
+
a
1
u+
a
0
u
,
where
R
1
(u),
R
2
(u)
arerationalfunctionsof
u
and
a
0
,
a
1,
a
2
,
0
,
1
,…,
n
areundeterminedcoefficients.
Westartbyusing
SolveAlways
tocomputetheundeterminedcoefficientsinthe
u
substitution:
In[]:=
3
u+
2
/.u
1
8
x
+
0
4
x
//TogetherSolveAlways[Numerator[%]
8
x
+1,x]
3
u+
2
,u
1
8
x
+
0
4
x
/.%/.
1
Out[]=
4
x
2
+
0
3
+
8
x
1
3
4
x
Out[]=
2
0,
0
1
3
,
1
1
3
Out[]=
u,u
1+
8
x
4
x
So we have a candidate substitution that fits the radicand part of the integrand. Does this substitution fit the rest of the integrand? We can compute this as follows:
We have made the same simplification to the integral that we made by hand previously, namely
8
x
+1
(
8
x
-1)
4
8
x
+1
x=
1
4
u-1
(u-2)(u+1)
4
u
u
,
where
u=
8
x
+1
4
x
.
This method is implemented with IntegrateAlgebraic at the Wolfram Function Repository. (In 2020, I further investigated the computation of pseudo-elliptic integrals in terms of elementary functions [9].) Given the simplicity of this method, it can integrate a wide range of integrals.
Here are some examples:
In[]:=
IntegrateAlgebraic
x+2
(x-1)
3
x
+3x-1
,x
Out[]=
-
2ArcTanh
3
x
-1+3x+
3
x
3
In[]:=
IntegrateAlgebraic
2
6
x
-1
(
6
x
+1)
6
x
+
2
x
+1
,x
Out[]=
-ArcTanh
x
1+
2
x
+
6
x
In[]:=
IntegrateAlgebraic
1
1/3
(
3
x
-
2
x
)
,x
Out[]=
-
3
ArcTan
x+2
1/3
(-
2
x
+
3
x
)
3
x
-Log-x+
1/3
(-
2
x
+
3
x
)
+
1
2
Log
2
x
+x
1/3
(-
2
x
+
3
x
)
+
2/3
(-
2
x
+
3
x
)
In[]:=
IntegrateAlgebraic
(
2
x
-1)
4
x
+
2
x
+1
(
2
x
+1)(
4
x
+
3
x
+
2
x
+x+1)
,x
Out[]=
-2ArcTan
1+
2
x
+
4
x
1-x+
2
x
+
2
5
(1+
5
)
ArcTan
1+
2
x
+
4
x
2+
5
(1-x+
2
x
)
+
2
5
(-1+
5
)
ArcTanh
-2+
5
1+
2
x
+
4
x
1+x+
2
x
In[]:=
IntegrateAlgebraic
(-2+
3
x
)
2+
2
x
+2
3
x
(1+
3
x
)(1+
2
x
+
3
x
)
,x
Out[]=
2ArcTan
2+
2
x
+2
3
x
x
-2ArcTanh
x
2+
2
x
+2
3
x
In[]:=
IntegrateAlgebraic
(x-1)
1/3
(
6
x
-
5
x
)
x+1
,x
Out[]=
1
54
-57+
121
x
+18x
1/3
(-
5
x
+
6
x
)
-
203ArcTan
2
x
+2
1/3
(-
5
x
+
6
x
)
3
2
x
27
3
+2
1/3
2
3
ArcTan
2
x
+
2/3
2
1/3
(-
5
x
+
6
x
)
3
2
x
+
203
81
Log-
2
x
+
1/3
(-
5
x
+
6
x
)
-2
1/3
2
Log-2
2
x
+
2/3
2
1/3
(-
5
x
+
6
x
)
-
203
162
Log
4
x
+
2
x
1/3
(-
5
x
+
6
x
)
+
2/3
(-
5
x
+
6
x
)
+
1/3
2
Log2
4
x
+
2/3
2
2
x
1/3
(-
5
x
+
6
x
)
+
1/3
2
2/3
(-
5
x
+
6
x
)
In[]:=
IntegrateAlgebraic
(
2
x
-2)(
2
x
-1)
(1-2
2
x
+
4
x
+
8
x
)
1/4
(1-
2
x
+
4
x
)
,x
Out[]=
-
1
4
RootSum2-2
4
#1
+
8
#1
&,
-Log[x]+Log
1/4
(1-
2
x
+
4
x
)
-x#1
#1
&
Unlike the algebraic case of the Risch algorithm, this technique can quickly solve many integrals involving parameters:
In[]:=
IntegrateAlgebraic
2
(a
4
x
-b)
2
(a
4
x
+b)
4
a
4
x
-b
,x
Out[]=
-
x
3/4
(-b+a
4
x
)
2(b+a
4
x
)
-
ArcTan
1/4
(-b+a
4
x
)
1/4
a
x
2
1/4
a
+
ArcTan
1/4
(-b+a
4
x
)
1/4
2
1/4
a
x
4
1/4
2
1/4
a
+
ArcTanh
1/4
a
x
1/4
(-b+a
4
x
)
2
1/4
a
-
ArcTanh
1/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og[x]
4
#1
+25aLog
1/4
(
3
x
+
4
x
)
-x#1
4
#1
-34bLog
1/4
(
3
x
+
4
x
)
-x#1
4
#1
-3bLog[x]
8
#1
+3bLog
1/4
(
3
x
+
4
x
)
-x#1
8
#1
&
What about the following integral?
x-1
(x+2)
3
x
-1
x
Unlike the previous examples, this integral is not solvable with a Laurent polynomial substitution.
In 1882, Günther developed a method for computing some otherwise difficult algebraic integrals [10]. Given the integral
p(x)
q(x)
n
r(x)
x,
where
p(x)
and
q(x)
are polynomials in
x
, Günther made the substitution
u=
s(x)
n
r(x)
,
such that the integral becomes
∫R(
n
u
)u,or∫uR(
n
u
)u,or
R(
n
u
)
u
u,
where
s(x)=
v
Q-P+R-1
Q-P+R-1
x
+
v
Q-P+R-2
Q-P+R-2
x
+…+
v
1
x+
v
0
,where
P=
deg
x
(p(x))
,
Q=
deg
x
(q(x))
,
R=
deg
x
(r(x))
and
v
0
,
v
1
,…,
v
Q-P+R-1
,
c
0
,
c
1
,
c
2
,
c
3
areundeterminedcoefficientsand
R(
n
u
)
isarationalfunctionin
n
u
withundeterminedcoefficients.
We can use Günther’s method to solve this integral in Mathematica as follows. The substitution is of the form:
In[]:=
sub=
v
2
2
x
+
v
1
x+
v
0
1/2
(
3
x
-1)
;
And we assume the integrand in
u
is of the form:
In[]:=
intu=
1
w
1
2
u
+
w
0
;
Then the integrand in
x
is given by:
In[]:=
intx=
D[sub,x]
w
1
2
u
+
w
0
/.usub//Cancel
Out[]=
-3
2
x
v
0
-2
v
1
-
3
x
v
1
-4x
v
2
+
4
x
v
2
2
-1+
3
x
-
w
0
+
3
x
w
0
+
2
v
0
w
1
+2x
v
0
v
1
w
1
+
2
x
2
v
1
w
1
+2
2
x
v
0
v
2
w
1
+2
3
x
v
1
v
2
w
1
+
4
x
2
v
2
w
1
Now we need to solve for the undetermined coefficients in the substitution (
We can substitute this solution into our integrand in
u
and substitution:
In[]:=
{intu,sub}={intu,sub}/.%/.
w
1
Out[]=
1
9
4
+
2
u
,
1
2
-x+
2
x
2
-1+
3
x
Nowwecanuse
Integrate
tocomputetheresultingintegral:
In[]:=
Integrate[intu,u]
Out[]=
2
3
ArcTan
2u
3
Then substitute back to solve our original integral:
In[]:=
%/.usub
Out[]=
2
3
ArcTan
2
1
2
-x+
2
x
2
3
-1+
3
x
A quick check that our solution is correct:
In[]:=
Simplify[
∂
x
%]
Out[]=
-1+x
(2+x)
-1+
3
x
A generalized version of Günther’s method is implemented in IntegrateAlgebraic. This method can solve many otherwise difficult integrals. Here are some examples:
In[]:=
IntegrateAlgebraic
3
x
+2
(
3
x
+
2
x
-1)
3
x
-1
,x
Out[]=
2ArcTan
-1+
3
x
x
In[]:=
IntegrateAlgebraic
(2
3
x
-1)(2
3
x
+1)
(
8
x
-
2
x
-1)
6
x
-1
,x
Out[]=
-ArcTanhx
-1+
6
x
In[]:=
IntegrateAlgebraic
x-2
(
2
x
+2)
1/3
(2
2
x
+x-1)
,x
Out[]=
-
1
2
3
ArcTan
2+2x+
1/3
(-1+x+2
2
x
)
3
1/3
(-1+x+2
2
x
)
+ArcTanh
1+x
1+x-2
1/3
(-1+x+2
2
x
)
+
1
6
Log[-1+x+2
2
x
]-
1
4
Log1+2x+
2
x
+(1+x)
1/3
(-1+x+2
2
x
)
+
2/3
(-1+x+2
2
x
)
In[]:=
IntegrateAlgebraic
2
x
-x+2
(
2
x
+4x+3)
1/3
(
2
x
-1)
,x
Out[]=
3
2/3
(-1+
2
x
)
1+x
+
7
4
3
ArcTan
1-x+
1/3
(-1+
2
x
)
3
1/3
(-1+
2
x
)
-
7
4
Log-1+x+2
1/3
(-1+
2
x
)
+
7
8
Log1-2x+
2
x
+(2-2x)
1/3
(-1+
2
x
)
+4
2/3
(-1+
2
x
)
In[]:=
IntegrateAlgebraic
x+2
(x-3)(
2
x
+1)
1/4
(1-
2
x
)
,x
Out[]=
ArcTan
1/4
2
-
1/4
2
x+
1/4
(1-
2
x
)
1/4
(1-
2
x
)
2
1/4
2
-
ArcTan
-
1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
2/3
b
-
Log
1/3
b
1/3
(-
2
b
+
2
a
2
x
)
2/3
2
a
2/3
b
+
Log
2/3
b
2/3
(-
2
b
+
2
a
2
x
)
2
2/3
2
a
2/3
b
+
Log
2/3
2
(-b-ax)+2
1/3
b
1/3
(-
2
b
+
2
a
2
x
)
2/3
2
a
2/3
b
-
1
2
2/3
2
a
2/3
b
Log2
2/3
b
2/3
(-
2
b
+
2
a
2
x
)
+
1/3
2
(
2
b
+2abx+
2
a
2
x
)+
2/3
2
4/3
b
1/3
(-
2
b
+
2
a
2
x
)
+a
1/3
b
x
1/3
(-
2
b
+
2
a
2
x
)
If we combine this method with integrating term by term after expanding the integrand into a sum of terms, we can handle more exotic algebraic integrals:
In[]:=
IntegrateAlgebraic
x+1
(
2
x
-3)
1/3
(
2
x
+1)
,x,"Expansion"True
Out[]=
1
6
1/3
1
2
(-5+3
3
)
ArcTan
-3
2/3
2
+
2/3
2
3
x-3
1/3
(1+
2
x
)
3
3
1/3
(1+
2
x
)
-
1
6
1/3
1
2
(5+3
3
)
ArcTan
3
2/3
2
+
2/3
2
3
x+3
1/3
(1+
2
x
)
3
3
1/3
(1+
2
x
)
+
1/3
1
2
(9+5
3
)
Log
2/3
2
(3+
3
x)-6
1/3
(1+
2
x
)
6
2/3
3
+
1/3
1
2
(9-5
3
)
Log
2/3
2
(-3+
3
x)+6
1/3
(1+
2
x
)
6
2/3
3
-
1
12
2/3
3
1/3
1
2
(9-5
3
)
Log
1/3
2
(-3+2
3
x-
2
x
)-6
2/3
(1+
2
x
)
+
2/3
2
-3
1/3
(1+
2
x
)
+
3
x
1/3
(1+
2
x
)
-
1
12
2/3
3
1/3
1
2
(9+5
3
)
Log6
2/3
(1+
2
x
)
+
1/3
2
(3+2
3
x+
2
x
)+
2/3
2
3
1/3
(1+
2
x
)
+
3
x
1/3
(1+
2
x
)
Combining the Laurent polynomial substitution method with the generalized Günther method and integrating term by term allows us to compute even more complex integrals:
In[]:=
IntegrateAlgebraic
x-1
(x+1)
1/3
(
3
x
-1)
,x,"Expansion"True
Out[]=
-
3
ArcTan
-
1/3
2
+
1/3
2
x+
1/3
(-1+
3
x
)
3
1/3
(-1+
3
x
)
1/3
2
+
ArcTan
3
x
x+2
1/3
(-1+
3
x
)
3
+
Log
1/3
2
(-1+x)-2
1/3
(-1+
3
x
)
1/3
2
-
1
3
Log-x+
1/3
(-1+
3
x
)
+
1
6
Log
2
x
+x
1/3
(-1+
3
x
)
+
2/3
(-1+
3
x
)
-
Log
2/3
2
(1-2x+
2
x
)+
1/3
2
(-2+2x)
1/3
(-1+
3
x
)
+4
2/3
(-1+
3
x
)
2
1/3
2
In this case, we wrote the integral as:
x-1
(x+1)
3
3
x
-1
x
x
3
3
x
-1
-2
x
(x+1)
3
3
x
-1
.
Thentheintegral
x
3
3
x
-1
wasreducedto
-1
3
1
3(u-1)
1/3
u
u
withthesubstitution
u=1-
-3
x
,whiletheintegral
x
(x+1)
3
3
x
-1
wasreducedto
6
u
4+
3
u
withthesubstitution
u=
1-x
1/3
(
3
x
-1)
.
Integrating expressions containing nested radicals has always been a tricky business. A well-known example is
A generalization of this approach is used within IntegrateAlgebraic. Here are some challenging examples:
In[]:=
IntegrateAlgebraic
1
(x-2)
2
x
+
4
x
+1
,x
Out[]=
1
2
x
+
1+
4
x
+
ArcTan
2
x
+
1+
4
x
-4+
17
-4+
17
-2
2
ArcTan
2
x
2
x
+
1+
4
x
1+
2
x
+
1+
4
x
+
4+
17
ArcTan
1
2
(-1+
17
)
x
2
x
+
1+
4
x
1+
2
x
+
1+
4
x
-
ArcTanh
2
x
+
1+
4
x
4+
17
4+
17
-
-4+
17
ArcTanh
1
2
(1+
17
)
x
2
x
+
1+
4
x
1+
2
x
+
1+
4
x
In[]:=
IntegrateAlgebraic
2
x
+
4
x
+1
3
(x+1)
4
x
+1
,x
Out[]=
x(2+5
2
x
+
4
x
)
2
x
+
1+
4
x
+(-1-5
2
x
-2
6
x
)
2
x
+
1+
4
x
+
1+
4
x
x(5+
2
x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
+c
h
b
d
f
-c
h
-
2
bg+ah
ArcTan
bg+ah
c-d
e+fx
g+hx
-bcg-ach-d
be+af
bg+ah
b
-bcg-ach-d
be+af
bg+ah
-
2
bg+ah
ArcTan
bg+ah
c-d
e+fx
g+hx
-bcg-ach+d
be+af
bg+ah
b
-bcg-ach+d
be+af
bg+ah
-
2
1/4
h
ArcTanh
1/4
h
c-d
e+fx
g+hx
d
f
+c
h
b
d
f
+c
h
All of the integrals in this post contain polynomial radicands; however, these methods generalize to rational radicands. For example:
In[]:=
IntegrateAlgebraic
(-2+x)(1-x+
2
x
)
3
x
(-1+x+
2
x
)
1/3
1-x+2
2
x
1-x+3
2
x
,x
Out[]=
(-1+x-3
2
x
)
2/3
1-x+2
2
x
1-x+3
2
x
2
x
-2
2/3
2
1/6
3
ArcTan
1
3
+
2
2/3
2
1/3
1-x+2
2
x
1-x+3
2
x
5/6
3
+
7ArcTan
1
3
+
2
1/3
1-x+2
2
x
1-x+3
2
x
3
3
+
7
3
Log-1+
1/3
1-x+2
2
x
1-x+3
2
x
-
2
2/3
2
Log-3+
2/3
6
1/3
1-x+2
2
x
1-x+3
2
x
1/3
3
-
7
6
Log1+
1/3
1-x+2
2
x
1-x+3
2
x
+
2/3
1-x+2
2
x
1-x+3
2
x
+
2/3
2
Log3+
2/3
6
1/3
1-x+2
2
x
1-x+3
2
x
+2
1/3
6
2/3
1-x+2
2
x
1-x+3
2
x
1/3
3
In[]:=
IntegrateAlgebraic
-36-6
2
x
+6
3
x
+
6
x
x(-6+
3
x
)(36-90x+122
2
x
-96
3
x
+51
4
x
-26
5
x
+15
6
x
-6
7
x
+
8
x
)
1/6
6+
3
x
-6+
3
x
,x
Out[]=
-
1
3
ArcTan
1/6
6+
3
x
-6+
3
x
-1+x
-
1
6
ArcTan
-1+2x-
2
x
+
1/3
6+
3
x
-6+
3
x
(-1+x)
1/6
6+
3
x
-6+
3
x
+
ArcTanh
(-
3
+
3
x)
1/6
6+
3
x
-6+
3
x
1-2x+
2
x
+
1/3
6+
3
x
-6+
3
x
2
3
There are still many algebraic integrals that these methods will not compute. For example, the following integral possesses an elementary (albeit enormous) solution:
x
3
3
x
-3
2
x
-3x-1
.
However, compared to the algebraic case of the Risch–Trager–Bronstein algorithm, which is not completely implemented in any computer algebra system, these methods are fast, simple and complement the existing integration capabilities of Mathematica’s Integrate function. We are currently considering including IntegrateAlgebraic within Integrate in an upcoming release.
References
[1] R. Risch, "The Problem of Integration in Finite Terms," American Mathematical Society,139(1), 1969 pp. 167–189.
[2] R. Risch, “The Solution of the Problem of Integration in Finite Terms,” Bulletin of the American Mathematical Society, 76(3), 1970 pp. 605–608.
[3] J. Davenport, “Integration of Algebraic Functions,” in EUROSAM ’79: Proceedings of the International Symposium on on Symbolic and Algebraic Computation, 1979 pp. 415–425.
[4] M. Bronstein, “Integration of Elementary Functions,” Journal of Symbolic Computation, 9(2), 1990 pp. 117–173.
[5] B. Trager, “Integration of Algebraic Functions,” dissertation, Massachusetts Institute of Technology, Dept. of Electrical Engineering and Computer Science, 1984.
[6] J. Slagle, “A Heuristic Program That Solves Symbolic Integration Problems in Freshman Calculus: Symbolic Automatic Integrator (SAINT),” dissertation, Massachusetts Institute of Technology, Dept. of Mathematics, 1961.
[7] M. Kauers, “Integration of Algebraic Functions: A Simple Heuristic for Finding the Logarithmic Part,” ISSAC ’08, 2008 pp. 133–140.
[8] B. Miller, “On the Integration of Elementary Functions: Computing the Logarithmic Part,” dissertation, Texas Tech University, Dept. of Mathematics and Statistics, 2012.
[9] S. Blake, “A Simple Method for Computing Some Pseudo-elliptic Integrals in Terms of Elementary Functions,” 2020. arxiv.org/abs/2004.04910.
[10] S. Günther, “Sur l’évaluation de certaines intégrales pseudo-elliptiques,” Bulletin de la Société Mathématique de France, 10, 1882 pp. 88–97. www.numdam.org/article/BSMF_1882__ 10__ 88_ 1.pdf.