Computation and proof of explicit continued fractions
Sebastien Maulat, ENS de LyonBruno Salvy, INRIA
LIP, Lyon
May 2015
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 1 / 14
Motivation
A long history
Huygens’ planetarium [Huygens, 1682]
De analysis infinitorum [Euler, 1748]
π is irrational [Lambert, 1761]
real roots isolation of P ∈ IR[X ] [Lenstra, 2002, Hallgren, 2007]
A new Stirling series as continued fraction [C. Mortici, 2009]
Renewed interest for numerical evaluation
Handbook of mathematical functions [Abramowitz and Stegun, 1964]
Continued Fractions for numerical analysis [Jones and Thron, 1988]
Continued Fractions with applications [Lorentzen and Waadeland, 1992]
Handbook of Continued Fractions for Special Functions[Cuyt, Peterson, Verdonk, Waadeland and Jones, 2008]
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 2 / 14
Motivation
Convergence
ln(1 + x) =4∑1
(−1)i+1 x i
i+ O(x5)
=1/2 x2 + x
1/6 x2 + x + 1+ O(x5)
=x
1 +x/2
1 +x/6
1 + x/3
+ O(x5)
zone with 10 correct digits, for x ∈ C(with n = 20 and n = 30)
Taylor at order 2n : convergence for |x | < 1,
Pade et order n/n : convergence for 1 + x /∈ IR−.
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 3 / 14
Objects
Corresponding continued fractions
(truncated) C-fraction:
n
Ki=0
aixαi
1:=
a0xα0
1 +a1xα1
1 +. . .
1 +an−1xαn−1
1 + anxαn
, ai ∈ C?, αi ∈ IN∗
Correspondence: {∞
Ki=0
aixαi
1
}'
{ ∞∑i=1
cixi
}([
a0
α0
], . . . ,
[anαn
])straightforward! (c1, . . . , cα0+...+αn)
regular C-fractions : when αi = 1.simple, many formulas and applications. [Stieltjes 1894, Cuyt et alii 2008]
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 4 / 14
Objects
Formulas
Some general classes
[Gauss]
2F1(a, b; c ; z)
2F1(a, b + 1; c + 1; z)= 1 +
∞
Km=1
pmz
1
p2k = − (k + b)(k + c − a)
(2k + c)(2k − 1 + c), p2k+1 = − (k + a)(k + c − b)
(2k + c)(2k + 1 + c)
where 2F1(a, b; c ; z) :=∑
n≥0(a)n(b)n
(c)nzn
n! , and (a)n := a(a + 1) · · · (a + n− 1).
[Khovanskii 1963] similar solution for
(1 + αz)zy ′ + (β + γz)y + δy 2 = εz , y(0) = −β/γ.
We look for C-fractions K∞m=1amz
1 with a2k and a2k+1 rational in k.
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 5 / 14
Objects
Formulas
Some general classes
[Gauss]
2F1(a, b; c ; z)
2F1(a, b + 1; c + 1; z)= 1 +
∞
Km=1
pmz
1
p2k = − (k + b)(k + c − a)
(2k + c)(2k − 1 + c), p2k+1 = − (k + a)(k + c − b)
(2k + c)(2k + 1 + c)
where 2F1(a, b; c ; z) :=∑
n≥0(a)n(b)n
(c)nzn
n! , and (a)n := a(a + 1) · · · (a + n− 1).
[Khovanskii 1963] similar solution for
(1 + αz)zy ′ + (β + γz)y + δy 2 = εz , y(0) = −β/γ.
We look for C-fractions K∞m=1amz
1 with a2k and a2k+1 rational in k.
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 5 / 14
Objects
Proofs
Proofs are performed:
by generalization/specialization,
sometimes indirectly, as in:
exp(x) = limk→∞(1 + x
k
)k.
They rely on:
3 terms linear recurrences,
the invariance of Riccati equations with rational coefficients
y ′(z) = py 2 + qy + r , p, q, r ∈ C(z),
under Mœbius transforms y2(z) :=az
1 + y(z)with a ∈ C?,
and q-analogues of these.
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 6 / 14
Equations as data structures
The equation as data structure
Proposition (Cauchy): the Riccati equation y ′(z) = py 2 + qy + r with y(0) = 0and p, q, r ∈ C(z) admits a unique power series solution y0. A sequence of powerseries (fn)n≥0 tends to y0 iff the remainder valuations satisfy:
val(f ′n − pf 2n − qfn − r)→∞
where val(∑
i≥0 cizi)
:= min{i ≥ 0 | ci 6= 0}.
Aim: one procedure
{y ′(z) = py 2 + qy + r , y(0) = 0} 7→ explicit C-fraction + proof
two steps: guessing the formula, and proving it,
the equation is non-linear,
classical tools are linear.
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 7 / 14
Equations as data structures
The equation as data structure
Proposition (Cauchy): the Riccati equation y ′(z) = py 2 + qy + r with y(0) = 0and p, q, r ∈ C(z) admits a unique power series solution y0. A sequence of powerseries (fn)n≥0 tends to y0 iff the remainder valuations satisfy:
val(f ′n − pf 2n − qfn − r)→∞
where val(∑
i≥0 cizi)
:= min{i ≥ 0 | ci 6= 0}.
Aim: one procedure
{y ′(z) = py 2 + qy + r , y(0) = 0} 7→ explicit C-fraction + proof
two steps: guessing the formula, and proving it,
the equation is non-linear,
classical tools are linear.
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 7 / 14
Equations as data structures
A guess and prove approach
riccati_to_cfrac({exp′(x) = exp(x), exp(0) = 1}, x = 0); exp(x) = 1 +x
1 +. . .
1 +
12(2k+1)
x
1 +
−12(2k+1)
x
. . .
Direct computation : (a0,...,a19)=(1,−12 ,
16 ,−1
6 ,...,1
10 ,−110 ,...,
138 ,−138 ).
Linear algebra : {−n2an+nan+1+n(n+3)an+2=0, (a0,a1,a2)=(1,− 12 ,
16 )},
a2k= 12(2k+1) , a2k+1= −1
2(2k+1) , k>0.
Proof : fn := 1 +Kni=0
aix1 −→n→∞
exp(x)?
. . .
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 8 / 14
Equations as data structures
A guess and prove approach
riccati_to_cfrac({exp′(x) = exp(x), exp(0) = 1}, x = 0); exp(x) = 1 +x
1 +. . .
1 +
12(2k+1)
x
1 +
−12(2k+1)
x
. . .
Direct computation : (a0,...,a19)=(1,−12 ,
16 ,−1
6 ,...,1
10 ,−110 ,...,
138 ,−138 ).
Linear algebra : {−n2an+nan+1+n(n+3)an+2=0, (a0,a1,a2)=(1,− 12 ,
16 )},
a2k= 12(2k+1) , a2k+1= −1
2(2k+1) , k>0.
Proof : fn := 1 +Kni=0
aix1 −→n→∞
exp(x)?
. . .
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 8 / 14
Equations as data structures
D-finiteness
A sequence is D-finite when it satisfies a linear recurrence with polynomialcoefficients. This recurrence is an effective data structure:
(an)n≥0 = 0 is decidable;
a recurrence can be computed for:
(an+1)n≥0 , (an − bn)n≥0 , (anbn)n≥0 ,(∑
i+j=n aibj
)n≥0
. . .
Example (squaring)
> rec:={ u(n+2) = (n+1)*u(n+1) + 2*u(n), u(0)=0, u(1)=1 }:
> gfun:-poltorec( u(n)^2, [rec], [u(n)], c(n) );
3 generators over Q(n) : u(n)2, u(n)u(n + 1), u(n + 1)2
{(8 n + 16
)c (n) +
(−2 n3 − 8 n2 − 14 n − 8
)c (n + 1) +(
−n3 − 5 n2 − 10 n − 8)
c (n + 2) + (n + 1) c (n + 3),
c (0) = 0, c (1) = 1, c (2) = 1}
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 9 / 14
Equations as data structures
D-finiteness
A sequence is D-finite when it satisfies a linear recurrence with polynomialcoefficients. This recurrence is an effective data structure:
(an)n≥0 = 0 is decidable;
a recurrence can be computed for:
(an+1)n≥0 , (an − bn)n≥0 , (anbn)n≥0 ,(∑
i+j=n aibj
)n≥0
. . .
Example (squaring)
> rec:={ u(n+2) = (n+1)*u(n+1) + 2*u(n), u(0)=0, u(1)=1 }:
> gfun:-poltorec( u(n)^2, [rec], [u(n)], c(n) );
3 generators over Q(n) : u(n)2, u(n)u(n + 1), u(n + 1)2
{(8 n + 16
)c (n) +
(−2 n3 − 8 n2 − 14 n − 8
)c (n + 1) +(
−n3 − 5 n2 − 10 n − 8)
c (n + 2) + (n + 1) c (n + 3),
c (0) = 0, c (1) = 1, c (2) = 1}
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 9 / 14
Equations as data structures
D-finiteness of the remainder
Recall that we wanted: val(f ′n − pf 2n − qfn − r)→∞.
for fn = 1 +a0x
1 +. . .
1 +anx
1
and p, q, r rational, we have fn = Pn/Qn with
{Pn = Pn−1 + anx Pn−2 (P−2,P−1) = (1, 0)
Qn = Qn−1 + anx Qn−2 (Q−2,Q−1) = (0, 1)
Lemma
Let Hn := Q2n(f ′n − pf 2
n − qfn − r), then fn → y0(z) ⇐⇒ val(H2n)→∞
Hn+i ∈ Vect(anP ′nQn, anPnQ ′n, Pn+1Q ′n+1, . . .) of finite dimension !
first recurrence for H2n,
Does not conclude
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 10 / 14
Equations as data structures
D-finiteness of the remainder
Recall that we wanted: val(f ′n − pf 2n − qfn − r)→∞.
for fn = 1 +a0x
1 +. . .
1 +anx
1
and p, q, r rational, we have fn = Pn/Qn with
{Pn = Pn−1 + anx Pn−2 (P−2,P−1) = (1, 0)
Qn = Qn−1 + anx Qn−2 (Q−2,Q−1) = (0, 1)
Lemma
Let Hn := Q2n(f ′n − pf 2
n − qfn − r), then fn → y0(z) ⇐⇒ val(H2n)→∞
Hn+i ∈ Vect(anP ′nQn, anPnQ ′n, Pn+1Q ′n+1, . . .) of finite dimension !
first recurrence for H2n,
Does not conclude =⇒ reduction of order . . . DEMO
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 10 / 14
Reduction of order
Principle: Guess and prove again !
Theorem (Dimension of the solutions space)
∀n, p0(n) 6= 0 =⇒ dim{(un)n≥0 , p0(n)un+d + · · ·+ pd(n)un = 0} = d.
Problem (2−n et 2n sont dans un bateau. . . )
Given {2an+2 − 5an+1 + 2an = 0, (a0, a1) = (1, 12 )},
show that limn→∞ an = 0.
guess a “small” recurrence: an+1 + αan = 0?(a0, a1) α = − 1
2 . {2bn+1 − bn = 0, b0 = 1}
it defines a new sequence (bn)n≥0 ,
we prove bn = an, by induction:
(b0, b1) = (a0, a1);2bn+2 − 5bn+1 + 2bn = (2bn+2 − bn+1)− 2(2bn+1 − bn) = 0.
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 11 / 14
Reduction of order
Miracle
all Riccati solutions in [Cuyt et alii, 2008] are covered,
and give a hypergeometric (Hn)n≥0 !
it generalizes to difference, and q-difference equations,=⇒ all explicit formulas in [Cuyt et alii, 2008]
Question: reciprocal ?
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 12 / 14
Classification
Classification
What are the
regular C-fractions
solutions of a Riccati equation with rational coefficients
with a hypergeometric remainder H2n ?
Symbolic study of the constraints. . . (DEMO ?). . . the formula of Khovanskii [Khovanskii 1963] for
(1 + αz)zy ′ + (β + γz)y + δy 2 = εz , y(0) = −β/γ
is the most general one ! (has a caracterization)
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 13 / 14
Classification
Classification
What are the
regular C-fractions
solutions of a Riccati equation with rational coefficients
with a hypergeometric remainder H2n ?
Symbolic study of the constraints. . . (DEMO ?)
. . . the formula of Khovanskii [Khovanskii 1963] for
(1 + αz)zy ′ + (β + γz)y + δy 2 = εz , y(0) = −β/γ
is the most general one ! (has a caracterization)
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 13 / 14
Classification
Classification
What are the
regular C-fractions
solutions of a Riccati equation with rational coefficients
with a hypergeometric remainder H2n ?
Symbolic study of the constraints. . . (DEMO ?). . . the formula of Khovanskii [Khovanskii 1963] for
(1 + αz)zy ′ + (β + γz)y + δy 2 = εz , y(0) = −β/γ
is the most general one ! (has a caracterization)
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 13 / 14
Conclusion
Conclusion
One procedure,
Riccati equation with rational coefficients7→ C-fraction with rational coefficients,proof with a quick and direct computation,
an implementation
prototype gfun:-ContFrac
generalizes by hand (to difference and q-difference equations),
and a classification. . .
to be continued
Maulat, Salvy (LIP, Lyon) Computing and proving continued fractions May 2015 14 / 14
Top Related