Rigorous Uniform Approximation of D-finite Functions - Alexandre Benoit

Mar 16, 2011 - compute the Chebyshev recurrence of order 2s ≥ 2r for i from 1 to s using the recurrence relation backwards, compute the first N coefficients of ...
359KB taille 1 téléchargements 167 vues
Introduction Computation of the coefficients Validation Conclusion

Rigorous Uniform Approximation of D-finite Functions Alexandre Benoit (INRIA), Joint work with

Mioara Jolde¸s (ENS Lyon, INRIA) and Marc Mezzarobba (INRIA)

March 16, 2011

1 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

I Introduction

2 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Approximation of D-finite Functions Definition A function is D-finite if it is solution of a linear differential equation with polynomial coefficients.

Examples About 60% of Abramowitz & Stegun cos, arccos, Airy functions, Bessel functions, ...

3 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Approximation of D-finite Functions Definition A function is D-finite if it is solution of a linear differential equation with polynomial coefficients.

Examples About 60% of Abramowitz & Stegun cos, arccos, Airy functions, Bessel functions, ... How can we approximate a D-finite function f ? Polynomial approximation: f (x) ≈

n X

fi x i

i=0

3 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Uniform Approximation of D-finite Functions

Problem Given an integer d, and a D-finite function f specified by a differential equation with polynomial coefficients and suitable boundary conditions, find the coefficients of a polynomial p(x) of degree d and a “small” bound B such that |p(x) − f (x)| < B for all x in [−1, 1].

4 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Uniform Approximation of D-finite Functions

Problem Given an integer d, and a D-finite function f specified by a differential equation with polynomial coefficients and suitable boundary conditions, find the coefficients of a polynomial p(x) of degree d and a “small” bound B such that |p(x) − f (x)| < B for all x in [−1, 1]. Applications: Repeated evaluation on a line segment Plot Numerical integration Computation of minimax approximation polynomials using the Remez algorithm

4 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Rigorous Uniform Approximation of D-finite Functions

Why? Get the correct answer, not an “almost” correct one Bridge the gap between scientific computing and pure mathematics speed and reliability

5 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Rigorous Uniform Approximation of D-finite Functions

Why? Get the correct answer, not an “almost” correct one Bridge the gap between scientific computing and pure mathematics speed and reliability

How? Use Floating-Point as support for fast computations Bound roundoff, discretization, truncation errors in numerical algorithms Compute enclosures instead of approximations

5 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Rigorous Uniform Approximation of D-finite Functions

Why? Get the correct answer, not an “almost” correct one Bridge the gap between scientific computing and pure mathematics speed and reliability

How? Use Floating-Point as support for fast computations Bound roundoff, discretization, truncation errors in numerical algorithms Compute enclosures instead of approximations

What? Interval arithmetic

5 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Chebyshev Series vs Taylor Series I Basic properties of Chebyshev polynomials Two approximations of f : by Taylor series f =

+∞ X

Tn (cos(θ)) = cos(nθ)

cn x n , cn =

n=0

f

(n)

(0) , n!

+∞ X

tn =

1 π

2

tn Tn (x),

1

−1

  0 Tn (x)Tm (x) √ π dx =  π 1 − x2

if m 6= n if m = 0 otherwise

Tn+1 = 2xTn − Tn−1

n=−∞

Z

1

−1

or by Chebyshev series f =

Z

Tn (t) √

T0 (x) = 1 T1 (x) = x

f (t) dt. 1 − t2

T2 (x) = 2x 2 − 1 T3 (x) = 4x 3 − 3x

6 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Chebyshev Series vs Taylor Series I Error of approximation for exp(x) 0.05

Two approximations of f : by Taylor series f =

+∞ X

cn x n , cn =

n=0

f (n) (0) , n!

0.025

or by Chebyshev series +∞ X

f =

x −1

tn Tn (x),

n=−∞

1 tn = π

Z

−0.5

0

0.5

1

Taylor expansion of order 3

−0.025

1

f (t) Tn (t) √ dt. 1 − t2 −1

Chebyshev expansion of order 3

−0.05 6 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Chebyshev Series vs Taylor Series II Approximation of arctan(2x) by Taylor expansion of degree 1 1

0.5

−0.5

−0.25

0

0.25

x 0.5

−0.5 arctan(2x) −1

Taylor approximation 7 / 19

Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Chebyshev Series vs Taylor Series II

Bad approximation outside its circle of convergence 1.5 1 0.5 x −1

−0.5

0

0.5

1

−0.5 −1

arctan(2x) Taylor approximation

−1.5

7 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Chebyshev Series vs Taylor Series II

Aspproximation of arctan(2x) by Chebyshev expansion of degree 1 1.5 1 0.5 x −1

−0.5

0

0.5

1

−0.5 −1

arctan(2x) Taylor approximation

−1.5

Chebyshev approximation 7 / 19

Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Previous Work

Computation of the Chebyshev coefficients for D-finite functions Using a relation between coefficients Clenshaw (1957) Using the recurrence relation between the coefficients Fox-Parker (1968) The tau method of Lanczos (1938), Ortiz (1969-1993)

Validation: Kaucher-Miranker (1984)

8 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Our Work

Given a linear differential equation with polynomial coefficients, boundary conditions and an integer d Compute a polynomial approximation p on [−1, 1] of degree d of the solution f in the Chebyshev basis in O(d) arithmetic operations. Compute a sharp bound B such that |f (x) − p(x)| < B, x ∈ [−1, 1] in O(d) arithmetic operations.

9 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

II Computation of the coefficients

10 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Chebyshev Series of D-finite Functions Theorem (60’s, BenoitJoldesMezzarobba11) P un Tn (x) is solution of a linear differential equation with polynomial coefficients iff the sequence un is cancelled by a linear recurrence with polynomial coefficients.

11 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Chebyshev Series of D-finite Functions Theorem (60’s, BenoitJoldesMezzarobba11) P un Tn (x) is solution of a linear differential equation with polynomial coefficients iff the sequence un is cancelled by a linear recurrence with polynomial coefficients. Recurrence relation + good initial conditions ⇒ Fast numerical computation of the coefficients P 1 n Taylor: exp = x n! Rec: u(n + 1) = u(n) n+1 u(0) = 1

1/0! = 1

u(1) = 1

1/1! = 1

u(2) = 0, 5

1/2! = 0, 5

.. . u(50) ≈ 3, 28.10−65

.. . 1/50! ≈ 3, 28.10−65 11 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Chebyshev Series of D-finite Functions Theorem (60’s, BenoitJoldesMezzarobba11) P un Tn (x) is solution of a linear differential equation with polynomial coefficients iff the sequence un is cancelled by a linear recurrence with polynomial coefficients. Recurrence relation + good initial conditions ⇒ Fast numerical computation of the coefficients P 1 n Taylor: exp = x n! Rec: u(n + 1) = u(n) n+1

P Chebyshev: exp = In (1)Tn (x) Rec: u(n + 1) = −2nu(n) + u(n − 1) u(0) = 1, 266

I0 (1) ≈ 1, 266

u(0) = 1

1/0! = 1

u(1) = 1

1/1! = 1

u(1) = 0, 565

I1 (1) ≈ 0, 565

1/2! = 0, 5

u(2) ≈ 0, 136

I2 (1) ≈ 0, 136

u(2) = 0, 5 .. . u(50) ≈ 3, 28.10−65

.. .

.. .

.. .

1/50! ≈ 3, 28.10−65 11 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Chebyshev Series of D-finite Functions Theorem (60’s, BenoitJoldesMezzarobba11) P un Tn (x) is solution of a linear differential equation with polynomial coefficients iff the sequence un is cancelled by a linear recurrence with polynomial coefficients. Recurrence relation + good initial conditions ⇒ Fast numerical computation of the coefficients P 1 n Taylor: exp = x n! Rec: u(n + 1) = u(n) n+1

P Chebyshev: exp = In (1)Tn (x) Rec: u(n + 1) = −2nu(n) + u(n − 1) u(0) = 1, 266

I0 (1) ≈ 1, 266

u(0) = 1

1/0! = 1

u(1) = 1

1/1! = 1

u(1) = 0, 565

I1 (1) ≈ 0, 565

1/2! = 0, 5

u(2) ≈ 0, 136

I2 (1) ≈ 0, 136

u(2) = 0, 5 .. . u(50) ≈ 3, 28.10−65

.. .

.. . 1/50! ≈ 3, 28.10−65

u(50) ≈ 4, 450.1067

.. . I50 (1) ≈ 2, 934.10−80 11 / 19

Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Convergent and Divergent Solutions of the Recurrence

Study of the Chebyshev recurrence If u(n) is solution, then there exists 1 another solution v (n) ∼ u(n)

Newton polygon of a Chebyshev recurrence

n

κ−2 = · · · = κ2 κ−3 κ3 S

12 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Convergent and Divergent Solutions of the Recurrence

Study of the Chebyshev recurrence

Newton polygon of a Chebyshev recurrence

n

If u(n) is solution, then there exists 1 another solution v (n) ∼ u(n)

κ−2 = · · · = κ2 κ−3 κ3 S

For the recurrence u(n + 1) + 2nu(n) − u(n − 1) Two independent solutions are In (1) ∼

1 (2n)!

and Kn (1) ∼ (2n)!

12 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Convergent and Divergent Solutions of the Recurrence

Study of the Chebyshev recurrence

Newton polygon of a Chebyshev recurrence

n

If u(n) is solution, then there exists 1 another solution v (n) ∼ u(n)

κ−2 = · · · = κ2 κ−3 κ3 S

For the recurrence u(n + 1) + 2nu(n) − u(n − 1) Two independent solutions are In (1) ∼

1 (2n)!

and Kn (1) ∼ (2n)!

Miller’s algorithm To compute the first N coefficients of the most convergent solution of a recurrence relation of order 2 Initialize u(N) = 0 and u(N − 1) = 1 and compute the first coefficients using the recurrence backwards Normalize u with the initial condition of the recurrence 12 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Algorithm for Computing the Coefficients

Algorithm Input: a differential equation of order r with boundary conditions Output: a polynomial approximation of degree N of the solution compute the Chebyshev recurrence of order 2s ≥ 2r for i from 1 to s using the recurrence relation backwards, compute the first N coefficients of the sequence u [i] starting with the initial conditions   u [i] (N + 2s), · · · , u [i] (N + i), · · · , u [i] (N + 1) = (0, · · · , 1, · · · , 0)

combine the s sequences u [i] according to the r boundary conditions and the s − r symmetry relations

13 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Example: Back to exp

u(52) = 0

I52 (1) ≈ 2, 77.10−84

u(51) = 1

I51 (1) ≈ 2, 88.10−82

u(50) = −102

I50 (1) ≈ 2, 93.10−80

.. .

.. .

u(2) ≈ −4, 72.1080

I2 (1) ≈ 0, 14

81

u(1) ≈ 1, 96.10

u(0) ≈ −4, 4.10

I1 (1) ≈ −0, 57

81

I0 (1) ≈ 1, 27

14 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Example: Back to exp

u(52) = 0

I52 (1) ≈ 2, 77.10−84

u(51) = 1

I51 (1) ≈ 2, 88.10−82

u(50) = −102

I50 (1) ≈ 2, 93.10−80

.. .

.. .

u(2) ≈ −4, 72.1080

I2 (1) ≈ 0, 14

81

u(1) ≈ 1, 96.10

u(0) ≈ −4, 4.10 C =

50 X

I1 (1) ≈ −0, 57

81

I0 (1) ≈ 1, 27

u(n)Tn (0) ≈ −3, 48.1081

n=−50

14 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Example: Back to exp u(52) =0 C u(51) ≈ −2, 88.10−82 C u(50) ≈ 2, 93.10−80 C .. .

I52 (1) ≈ 2, 77.10−84 I51 (1) ≈ 2, 88.10−82 I50 (1) ≈ 2, 93.10−80 .. .

u(2) ≈ 0, 14 C u(1) ≈ −0, 57 C u(0) ≈ 1.27 C 50 X C = u(n)Tn (0) ≈ −3, 48.1081

I2 (1) ≈ 0, 14 I1 (1) ≈ −0, 57 I0 (1) ≈ 1, 27

n=−50

14 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

III Validation

15 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Fixed Point Theorem Applied to a Differential Equation f is solution of y 0 (x) − a(x)y (x) = 0, with y (0) = y0 , if and only if f is a fixed point of τ defined by Z t τ (y )(t) = y0 + a(x)y (x)dx. 0

16 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Fixed Point Theorem Applied to a Differential Equation f is solution of y 0 (x) − a(x)y (x) = 0, with y (0) = y0 , if and only if f is a fixed point of τ defined by Z t τ (y )(t) = y0 + a(x)y (x)dx. 0

For all rational functions a(x), there exists i such that τ i is a contraction map from the space of continuous functions to itself. We deduce: τ i (B(p, R)) ⊂ B(p, R) =⇒ f ∈ B(p, R)

16 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Fixed Point Theorem Applied to a Differential Equation f is solution of y 0 (x) − a(x)y (x) = 0, with y (0) = y0 , if and only if f is a fixed point of τ defined by Z t τ (y )(t) = y0 + a(x)y (x)dx. 0

For all rational functions a(x), there exists i such that τ i is a contraction map from the space of continuous functions to itself. We deduce: τ i (B(p, R)) ⊂ B(p, R) =⇒ f ∈ B(p, R)

Goal: Computation of R Given p, find i, pi and Ri such that τ i (B(p, R)) ⊂ B(pi , Ri ) ⊂ B(p, R) 16 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Algorithm for a Differential Equation of Order 1 Given p, find i, pi and Ri such that τ i (B(p, R)) ⊂ B(pi , Ri ) ⊂ B(p, R) Algorithm (Find R) p0 := p i

while i! < kak∞ Compute pi (t) a “good” approximation of y0 + Mi = kτ (pi−1 ) − pi k∞

Return R=

kpi − pk∞ + 1−

Pi

j=1

Mj

Rt 0

a(x)pi−1 (x)dx

kakj∞ j!

kaki∞ i!

17 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Algorithm for a Differential Equation of Order 1 Given p, find i, pi and Ri such that τ i (B(p, R)) ⊂ B(pi , Ri ) ⊂ B(p, R) Algorithm (Find R) p0 := p i

while i! < kak∞ Compute pi (t) a “good” approximation of y0 + Mi = kτ (pi−1 ) − pi k∞

Return R=

kpi − pk∞ + 1−

Pi

j=1

Mj

Rt 0

a(x)pi−1 (x)dx

kakj∞ j!

kaki∞ i!

f ∈ B(p, R) =⇒ f = τ i (f ) ∈ B(pi , Ri ), with Ri =

i j X kak∞ Mj |t|i i + kak∞ R j! i! j=1

17 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Algorithm for a Differential Equation of Order 1 Given p, find i, pi and Ri such that τ i (B(p, R)) ⊂ B(pi , Ri ) ⊂ B(p, R) Algorithm (Find R) p0 := p i

while i! < kak∞ Compute pi (t) a “good” approximation of y0 + Mi = kτ (pi−1 ) − pi k∞

Return R=

kpi − pk∞ + 1−

Pi

j=1

Mj

Rt 0

a(x)pi−1 (x)dx

kakj∞ j!

kaki∞ i!

f ∈ B(p, R) =⇒ f = τ i (f ) ∈ B(pi , Ri ), with Ri =

i j X kak∞ Mj |t|i i + kak∞ R j! i! j=1

kf − pk∞ ≤ kf − pi k∞ + kp − pi k∞ ≤ Ri + kp − pi k∞ = R Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

17 / 19

Introduction Computation of the coefficients Validation Conclusion

IV Conclusion

18 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.

Introduction Computation of the coefficients Validation Conclusion

Final Algorithm

Algorithm INPUT: Differential equation with boundary conditions and a degree d OUTPUT: a polynomial approximation of degree d and a bound Compute an approximation P of degree d of the solution with the first algorithm Compute the bound B of the approximation with the second algorithm. return the pair P, B

19 / 19 Alexandre Benoit

Rigorous Uniform Approximation of D-finite Functions.