Explorer les Livres électroniques
Catégories
Explorer les Livres audio
Catégories
Explorer les Magazines
Catégories
Explorer les Documents
Catégories
Calcul Numérique
Les transparents sont gratuits
2 septembre 2021
Sommaire
1 Présentation du cours
3 Polynomial Interpolation
4 Intégration Numérique
5 Dérivation numérique
Contents
1 Présentation du cours
3 Polynomial Interpolation
4 Intégration Numérique
5 Dérivation numérique
Contours
Objectifs
Prérequis
Contenu minimal
Les approximations des fonctions, des dérivées, des intégrales et des racines des
fonctions non linéaires.
Activités pratiques
Méthodes pédagogiques
Stratégie d’évaluation
Bibliographie
Auditoire
Contents
1 Présentation du cours
3 Polynomial Interpolation
4 Intégration Numérique
5 Dérivation numérique
Formule de Taylor avec reste intégral. On approxime une fonction par un polynôme.
f (x + h) = pn (x) + Rn (x)
Ex : approximer ex en x = 0 par une droite, puis une parabole et enfin une courbe du
troisième dégré.
Formule de Taylor avec reste intégral. Le reste est donnée par une expression exacte.
On a posé (variable t)
1
u0 = (x − t)n−1 v = f (n) (t)
(n − 1)!
u0 vdt = uv − uv 0 dt
R R
1.
Présentation du cours
Rappel sur le Développement en série
Polynomial Interpolation
Intégration Numérique
Dérivation numérique
Equations non-linéaires d’une variable
Calcul numérique approchés et erreurs
avec h > 0 et x ≤ θ ≤ x + h et où
avec h > 0 et x ≤ θ ≤ x + h et où
sin(4) (θ) 4
R3 (x) = h
(4)!
d’où
sin(π/2) cos(π/2)
sin(π/2 + π/4) = sin(π/2) + cos(π/2)π/4 − (π/4)2 − (π/4)3
2! 3!
sin(θ)
+ (π/4)4
(4)!
Exemple. Développement de ex
ex 2 ex 3 eθ 4
e(x+h) = ex + ex h + h + h + h
2! 3! (4)!
avec h > 0 et x ≤ θ ≤ x + h et où
eθ 4
R3 (x) = h
(4)!
e1 e1 eθ
e(1+0.2) = e1 + e1 (0.2) + (0.2)2 + (0.2)3 + (0.2)4
2! 3! (4)!
avec h > 0 et x ≤ θ ≤ x + h et où
eθ
R3 (x) = (0.2)4
(4)!
1 1 2
ln(x + h) = ln(x) + h− h + ···
x 2x2
Exercice
Approximer ex en x = 0 par
une droite,
puis une parabole
et enfin une courbe du troisième dégré.
On part de
ex 2 ex 3 eθ 4
e(x+h) = ex + ex h + h + h + h
2! 3! (4)!
avec x = 0.
où
Rn (x) = o(hn )
avec
o(hn )
lim =0
h→0 hn
Le reste est d’un ordre de grandeur inférieur au dernier terme du polynôme.
Contents
1 Présentation du cours
3 Polynomial Interpolation
4 Intégration Numérique
5 Dérivation numérique
Introductory example
Let
x = [1, −1, 3] and y = [−2, 4, 8];
be two associated vectors ; or, equivalently, let
be three given points in a Cartesian plan. Find the scalars a, b and c such that these
points satisfy the second degree polynomial
y = ax2 + bx + c.
y = 2x2 − 3x − 1
Introductory example
Given n + 1 couples of data (xi , yi ), i = 0, . . . , n with xi 6= xj (to see later about the
determinant) for all i 6= j, find the n + 1 coefficients a0 , a1 , . . . , an such that
n
X
pn (x) = a0 + a1 x + a2 x2 + · · · + an xn = aj xj ,
j=0
the polynomial of degree at most n that interpolates to the given data, which means
pn (xi ) = yi , i = 0, . . . , n.
a2 x20 ··· an xn
a0 + a1 x0 + + 0 = y0
a0 + a1 x1 + a2 x21 ··· + an xn = y1
1
..
.
a2 x2n an xn
a0 + a1 xn + ··· + n = yn
It is worth to bear in mind that the unknowns are the polynomial coefficients
a0 , a1 , . . . , an . The couples (xi , yi ) are the data.
Caution : don’t try to solve the polynomial interpolation via the solution of this
system. It is expensive to solve in terms of computation cost. It also unstable. There
exists a easier way to find the solution.
What is it ?
x20 ··· xn
1 x0
0
1 x1 x21 ··· xn
1
∆n = .. .. .. .. .
. . . ··· .
1 xn x2n ··· xnn
It depends only on x0 , x1 , . . . , xn .
Proposition
Y
∆n = (xj − xi )
0≤i<j≤n
We study this determinant for theoretical and analytical reasons but not for
computation reasons. Notice again that a convenient way to find an interpolation
polynomial exists.
Exo. Try to describe the structure of the Van Der Monde determinant.
What is it ?
Observe that
Proof. Preliminary.
xn−1
1 x0 x20 ··· 0 xn0
n−1
0 x1 − x0 x21 − x20 ··· x1 − xn−1
0 xn
1 − x0
n
n−1
∆n = 0 x2 − x0 x22 − x20 ··· x2 − xn−1
0 xn
2 − x n
0
.
.. .. .. .. ..
. . . ··· . .
xn−1 − xn−1
0 xn − x0 x2n − x20 ··· n 0 xn
n − x0
n
Write
xn−1
1 x1 ··· 1
1 x2 ··· xn−1
2
∆n−1 =
.. .. ..
. . ··· .
n−1
1 xn ··· xn
Now, observing that ∆0 = 1, one can apply the recurrence reasoning to conclude the
proof.
Présentation du cours
Rappel sur le Développement en série Lagrange Interpolation
Polynomial Interpolation Error in Lagrange Interpolation for a Function f (x)
Intégration Numérique Runge phenomenon
Dérivation numérique Hermite Interpolation
Equations non-linéaires d’une variable Exercices
Calcul numérique approchés et erreurs
Exercise
x = [−55, −25, 5, 35, 65] and y = [−3.25, −3.2, −3.02, −3.32, −3.1];
Write down the associated system of equations and express the associated
determinant. Compute the determinant.
Proposition
Since, by hypothesis, xi 6= xj for all i 6= j,
Y
∆n = (xj − xi ) 6= 0.
0≤i<j≤n
Consequently, the solution of the system, that is, the set of polynomial coefficients
a0 , a1 , . . . , an exists and is unique.
Lagrange polynomials
There exists an easier way to compute an interpolation polynomial without going
through solving a system of linear equations.
Definition
Given n + 1 points (xi , yi ) i = 0, . . . , n with xi 6= xj for all i 6= j we call
n
Y (x − xj )
li (x) = , i = 0, 1, . . . n,
(xi − xj )
j =0
j 6= i
Observe that
0 if j 6= i
li (xj ) =
1 if j = i
(x − x1 ) (x − x2 ) (x + 1)(x − 3)
l0 (x) = =
(x0 − x1 ) (x0 − x2 ) −4
(x − x0 ) (x − x2 ) (x − 1)(x − 3)
l1 (x) = =
(x1 − x0 ) (x1 − x2 ) 8
(x − x0 ) (x − x1 ) (x − 1)(x + 1)
l2 (x) = =
(x2 − x0 ) (x2 − x1 ) 8
writes
y = 2x2 − 3x − 1
Présentation du cours
Rappel sur le Développement en série Lagrange Interpolation
Polynomial Interpolation Error in Lagrange Interpolation for a Function f (x)
Intégration Numérique Runge phenomenon
Dérivation numérique Hermite Interpolation
Equations non-linéaires d’une variable Exercices
Calcul numérique approchés et erreurs
Lagrange polynomials
Theorem
n
X
pn (x) = y0 l0 (x) + y1 l1 (x) + · · · + yn ln (x) = yi li (x).
i=0
This tells us that pn (x) of degree n takes the same values as yi at nodes xi ,
i = 0, . . . , n.
Exercises
answer :
4
p2 (x) = − x(x − π);
π2
answer :
p1 = 0.693 (x − 1)
Exercises
Figure – exo 1. The solid black line represents the interpolant curve. The
dashed red line represents the sine
Exercises
Figure – exo 2.
Here, we are concerned with the interpolation of data from a function f (x) by a
polynomial pn (x) on the set of (n + 1) nodes x0 , . . . xn .
Theorem
Suppose f (x), the function to be interpolate, is n + 1 times differentiable. For all x,
there exists a point θx ∈ [x0 , xn ] depending on x such that
n
f (n+1) (θx ) Y
En (x) = f (x) − pn (x) = (x − xi )
(n + 1)! i=0
Présentation du cours
Rappel sur le Développement en série Lagrange Interpolation
Polynomial Interpolation Error in Lagrange Interpolation for a Function f (x)
Intégration Numérique Runge phenomenon
Dérivation numérique Hermite Interpolation
Equations non-linéaires d’une variable Exercices
Calcul numérique approchés et erreurs
n
Y
(x − xi ) = (x − x0 )(x − x1 ) · · · (x − xn )
i=0
Figure – The dashed curve on the graph shows the error of interpolation
En (x) = f (x) − p2 (x) = sin(x) − (1.2732 x − 0.4053 x2 ), the red curve shows pn (x), the blue
curve shows sin(x)
Figure – The dashed curve on the graph shows the error of interpolation
En (x) = f (x) − p1 (x) = ln(x) − (0.693x − 0.693), the red curve shows pn (x), the blue curve shows
ln(x)
Define
n
Y
h(x) = (x − xi ) = (x − x0 )(x − x1 ) · · · (x − xn ),
i=0
Observe that
h(xi ) = 0, i = 0, 1, . . . , n,
h(n+1) (x) = (n + 1)!
g(xi ) = 0, i = 0, 1, . . . , n, ∀ α
since f (x) and pn (x) coincide on nodes.
Proof (2)
It follows that the continuous g(x) possesses at least (n + 1) extremums which implies
that its derivative g 0 (x) has in turn at least (n + 1) zeros.
Finally, g (n+1) (x) has at least 1 zero which we denote by θx̂ ∈ [x0 , xn ]. It is clear
that as αx̂ this quantity is also related to the choice of x̂.
Proof (3)
To calculate α, first compute the (n + 1) derivative of g(x), recalling that pn (x) is
polynomial of degree n :
(n+1)
g (n+1) (x) = f (n+1) (x) − pn (x) − αx̂ h(n+1) (x)
= f (n+1) (x) − αx̂ (n + 1)!
1
αx̂ = f (n+1) (θx̂ ).
(n + 1)!
Now,
g(x̂) = f (x̂) − pn (x̂) − αx̂ h(x̂) = 0
or, alternatively,
n
1 Y
f (x̂) − pn (x̂) = f (n+1) (θx̂ ) (x̂ − xi )
(n + 1)! i=0
Qn
The polynomial i=0 (x − xi ) plays a great role in the error of interpolation.
Equidistant nodes
Tchebyshev nodes
Let [a, b] be the interpolation interval, and n + 1, the number of nodes. Define the
length step
b−a
h=
n
and then consider n + 1 equidistant nodes within [a, b]. So, the nodes are given by
xi = a + ih with i = 0, 1, . . . , n.
Lemma
For equidistant nodes, we have :
We see that φ(s) = |s(s − 1)(s − 2)(s − 3)(s − 4)| reach its maximum in [0, 1].
(a) Equidistant nodes. Proof
n
The fact that φ(n − s) = φ(s) shows that φ is symmetric with respect to s = 2
.
Hence for s ∈ [0, n] one may search the maximum of φ(s) in the half subinterval
[0, n
2
].
max φ(s) = maxn φ(s)
s∈[0,n] s∈[0, 2 ]
n n
Partition [0, 2
] into two subintervals [0, 1[ and [1, 2
]. We have
φ(s − 1)
= (n − s + 1)/s
φ(s)
n
and we see that (n − s + 1)/s > 1 for s ∈ [1, 2
].
n
Consequently, φ(s) < φ(s − 1) < φ(s − 2) < · · · . It follows that for s ∈ [0, 2
]
one should search the maximum of φ(s) uniquely in [0, 1[. That is
max |s(s − 1) . . . (s − n)| < max |s(s − 1)| · 2 · . . . · n = max |s(s − 1)|n!
s∈[0,n]
(a) Equidistant nodes
Observe that
1
max |s(s − 1)| =
0≤s≤1 4
which leads to the following theorem.
Theorem
For equidistant nodes, we have :
n
Y 1
max (x − xi ) ≤ n! hn+1 ,
x∈]a,b[
i=0
4
Consequently,
1 hn+1
max |En (x)| ≤ max f (n+1) (x)
x∈]a,b[ x∈]a,b[ 4 (n + 1)
Présentation du cours
Rappel sur le Développement en série Lagrange Interpolation
Polynomial Interpolation Error in Lagrange Interpolation for a Function f (x)
Intégration Numérique Runge phenomenon
Dérivation numérique Hermite Interpolation
Equations non-linéaires d’une variable Exercices
Calcul numérique approchés et erreurs
Recall
p+q p−q
cos p + cos q = 2 cos cos
2 2
p+q p−q
cos p − cos q = −2 sin sin
2 2
p+q p−q
sin p + sin q = 2 sin cos
2 2
p−q p+q
sin p − sin q = 2 sin cos
2 2
the leading coefficient of the n degree polynomial tn is 2n−1 and its n roots are
2i + 1
ui = cos π ∈ ] − 1, 1[, i = 0, 1, 2, . . . n − 1
2n
2i + 1
ui = cos π ∈] − 1, 1[, i = 0, 1, 2, . . . n
2(n + 1)
This together with the fact that the leading coefficient is 2n give
n
Y
tn+1 (u) = 2n (u − ui ) = 2n (u − u0 )(u − u1 ) · · · (u − un )
i=0
(b) Tchebyshev nodes
Definition
For a polynomial of degree n in [-1, 1], the n + 1 so called Tchebyshev nodes are given
by :
2i + 1
ui = cos π ∈ [−1, 1] , 0≤i≤n
2(n + 1)
They are the roots of tn+1 .
Definition
For a polynomial of degree n in [a, b], the n + 1 so called Tchebyshev-Gauss nodes are
given by the linear bijection u ∈ [−1, 1] −→ x ∈ [a, b]
a+b b−a
x= + u.
2 2
Thus
a+b b−a 2i + 1
xi = − cos π ∈ [a, b] 0≤i≤n
2 2 2(n + 1)
(b) Tchebyshev nodes
n n
n+1 Y
Y b−a
(x − xi ) = (u − ui )
i=0
2 i=0
with
n
Y 1
(u − ui ) = tn+1
i=0
2n
n n+1
Y b−a
(x − xi ) = 2 Tn+1 (u)
i=0
4
and finally
n n+1
Y b−a
max | (x − xi )| = 2 max |Tn+1 (u)|
i=0
4
where
Theorem
For Tchebyshev nodes, we have :
n
b − a n+1
Y
max (x − xi ) ≤ 2 ,
x∈]a,b[
i=0
4
Consequently,
b − a n+1
(n+1)
f (x)
max |En (x)| ≤ max 2
x∈]a,b[ x∈]a,b[ (n + 1)! 4
Comparison of bounds
n = 5;
a = −1; b = 1 ;
h = ( b − a )/ n ;
% Noeuds e q u i d i s t a n t s
x = a : h : b,
i = 0 : n;
% Noeuds de T c h e b y c h e v
xx = − c o s ( ( 2 ∗ i + 1 ) ∗ p i / ( 2 ∗ n + 2 ) ) ,
Exercises
1 Interpolate the function sin(x) in interval [0, π] with (a) 3 nodes and (b) 5
nodes.
i xi f (xi ) = sin(xi )
0 0 √0
1 π/4 2/2
2 π/2 √1
3 3π/4 2/2
4 π 0
π π 3π
(x − x1 )(x − x2 )(x − x3 )(x − x4 ) (x − 4
)(x − 2
)(x − 4
)(x − π)
l0 (x) = = 32
(x0 − x1 )(x0 − x2 )(x0 − x3 )(x0 − x4 ) 3π 4
π 3π
(x − x0 )(x − x2 )(x − x3 )(x − x4 ) x(x − 2
)(x − 4
)(x − π)
l1 (x) = = −128
(x1 − x0 )(x1 − x2 )(x1 − x3 )(x1 − x4 ) 3π 4
(x − x0 )(x − x1 )(x − x3 )(x − x4 ) x(x − π4 )(x − 3π
4
)(x − π)
l2 (x) = = 64
(x2 − x0 )(x2 − x1 )(x2 − x3 )(x2 − x4 ) π4
(x − x0 )(x − x1 )(x − x2 )(x − x4 ) x(x − π4 )(x − π2 )(x − π)
l3 (x) = = −128
(x3 − x0 )(x3 − x1 )(x3 − x2 )(x3 − x4 ) 3π 4
π π 3π
(x − x0 )(x − x1 )(x − x2 )(x − x3 ) x(x − 4
)(x − 2
)(x − 2
)
l4 (x) = = 32
(x4 − x0 )(x4 − x1 )(x4 − x2 )(x4 − x3 ) 3π 4
Partial solution. Please check !
√ 64 π 3π
pn (x) = − 2 x(x − )(x − )(x − π)
3π 4 2 4
64 π 3π
+ 4 x(x − )(x − )(x − π)
π 4 4
√ 64 π π
− 2 x(x − )(x − )(x − π)
3π 4 4 2
64
= x(x − π) ×
π4
" √ √ #
2 π 3π π 3π 2 π π
− (x − )(x − ) + (x − )(x − )− (x − )(x − )
3 2 4 4 4 3 4 2
Partial solution. Please check !
Partial solution. Please check !
Figure – The solid curve shows sin(x), the dashed curve shows pn (x) and the
dotted curve shows sin(x) − pn (x)
Partial solution. Please check !
a+b b−a iπ
For 5 Chebychev nodes xi = 2
− 2
cos n
with a = 0 and b = π, the data are
i xi f (xi ) = sin(xi )
0 ∗ ∗
1 ∗ ∗
2 ∗ ∗
3 ∗ ∗
4 ∗ ∗
Example
1
1 Interpolate the function 1+x 2 in interval [−5, 5] with (a) 5 nodes and (b) 7
nodes using equidistant nodes
1
Figure – Runge phenomenon. Interpolating 1+x2
Présentation du cours
Rappel sur le Développement en série Lagrange Interpolation
Polynomial Interpolation Error in Lagrange Interpolation for a Function f (x)
Intégration Numérique Runge phenomenon
Dérivation numérique Hermite Interpolation
Equations non-linéaires d’une variable Exercices
Calcul numérique approchés et erreurs
Hermite interpolation
We need an interpolating polynomial that coincides the function at nodes and whose
first order derivative coincide with the derivative of the function at nodes.
n 2
x − xj
Y
qi (x) = li2 (x) = , i = 0, . . . , n
j=0, j6=i
xi − xj
Observe that
n
1, si i = j X 2
qi (xj ) = qi0 (xi ) = .
0, si i 6= j xi − xk
k=0, k6=i
Next, set
Observe that
Caution : Be aware on the fact that here qi0 (xi ) = qi0 (x)|xi . Not to be confused with
[qi (xi )]0 which is 0, since qi (xi ) is not a function, but a valued function, that is un
number.
Hermite interpolation
n
X
h0 (x)|xi = qi0 (x)hi (x) + qi (x)h0i (x) x = f 0 (xi )
h(x)|xi = f (xi ) and
i
i=0
Comments : To perform this interpolation, on needs the first order derivatives are
available because this is required in building h(x)
A partial proof
(x − x0 )2 (x − x1 )2 (x − xi−1 )2 (x − xi+1 )2 (x − xn )2
qi (x) = 2 2
··· 2 2
···
(xi − x0 ) (xi − x1 ) (xi − xi−1 ) (xi − xi+1 ) (xi − xn )2
Thus
and
qi0 (x)|xj = 0, ∀ j 6= i
Présentation du cours
Rappel sur le Développement en série Lagrange Interpolation
Polynomial Interpolation Error in Lagrange Interpolation for a Function f (x)
Intégration Numérique Runge phenomenon
Dérivation numérique Hermite Interpolation
Equations non-linéaires d’une variable Exercices
Calcul numérique approchés et erreurs
Exercises
Theorem
Suppose f (x), the function to be interpolate, is 2n + 2 times differentiable. For all x,
there exists a point θx ∈ [x0 , xn ] depending on x such that
n
f (2n+2) (θx ) Y
En (x) = f (x) − hn (x) = (x − xi )2
(2n + 2)! i=0
Exercises
1
Perform the Hermite interpolation of f (x) = 1+x2
in interval [−5, 5] with 5
nodes, that is n + 1 = 5.
xi = a + ih, i = 0, 1, 2, 3, 4
b+a b−a
xi = − cos(iπ/n) i = 0, 1, 2, 3, 4
2 2
1 2xi
i xi f (x)|xi = 1+x2
f 0 (x)|xi = − (1+x 2 )2
i i
0 −5 1/26 10/262
1 −5/2 4/29 80/292
2 0 1 0
3 5/2 4/29 −80/292
4 5 1/26 −10/262
Compute differences xi − xj , i 6= j
Q4
x0 x1 x2 x3 x4 j=0,j6=i (xi − xj )
x0 ∗ −5/2 −5 −15/2 −10 (−5)(−5)(−15)(−10)/4
x1 5/2 ∗ −5/2 −5 −15/2 (5)(−5)(−5)(−15)/8
x2 5 5/2 ∗ −5/2 −5 (5)(5)(−5)(−5)/4
x3 15/2 5 5/2 ∗ −5/2 (15)(5)(5)(−5)/8
x4 10 15/2 5 5/2 ∗ (10)(15)(5)(5)/4
The squares of Lagrange polynomials
!2 !2
(x − x1 )(x − x2 )(x − x3 )(x − x4 ) (x + 5/2)(x)(x − 5/2)(x − 5)
q0 (x) = =
(x0 − x1 )(x0 − x2 )(x0 − x3 )(x0 − x4 ) (−5)(−5)(−15)(−10)/4
!2 !2
(x − x0 )(x − x2 )(x − x3 )(x − x4 ) (x + 5)(x)(x − 5/2)(x − 5)
q1 (x) = =
(x1 − x0 )(x1 − x2 )(x1 − x3 )(x1 − x4 ) (5)(−5)(−5)(−15)/8
!2 !2
(x − x0 )(x − x1 )(x − x3 )(x − x4 ) (x + 5)(x + 5/2)(x − 5/2)(x − 5)
q2 (x) = =
(x2 − x0 )(x2 − x1 )(x2 − x3 )(x2 − x4 ) (5)(5)(−5)(−5)/4
!2 !2
(x − x0 )(x − x1 )(x − x2 )(x − x4 ) (x + 5)(x + 5/2)x(x − 5)
q3 (x) = =
(x3 − x0 )(x3 − x1 )(x3 − x2 )(x3 − x4 ) (15)(5)(5)(−5)/8
!2 !2
(x − x0 )(x − x1 )(x − x2 )(x − x3 ) (x + 5)(x + 5/2)x(x − 5/2)
q4 (x) = =
(x4 − x0 )(x4 − x1 )(x4 − x2 )(x4 − x3 ) (10)(15)(5)(5)/4
2 2 2 2
q00 (x0 ) = + + + = −5/3
(x0 − x1 ) (x0 − x2 ) (x0 − x3 ) (x0 − x4 )
2 2 2 2
q10 (x1 ) = + + + = −2/3
(x1 − x0 ) (x1 − x2 ) (x1 − x3 ) (x1 − x4 )
2 2 2 2
q20 (x2 ) = + + + =0
(x2 − x0 ) (x2 − x1 ) (x2 − x3 ) (x2 − x4 )
2 2 2 2
q30 (x3 ) = + + + = 2/3
(x3 − x0 ) (x3 − x1 ) (x3 − x2 ) (x3 − x4 )
2 2 2 2
q40 (x4 ) = + + + = 5/3
(x4 − x0 ) (x4 − x1 ) (x4 − x2 ) (x4 − x3 )
!2
(x + 5/2)(x − 0)(x − 5/2)(x − 5)
h(x) = h0 (x)
(−5)(−5)(−15)(−10)/4
!2
(x + 5)(x − 0)(x − 5/2)(x − 5)
+ h1 (x)
(5)(−5)(−5)(−15)/8
!2
(x + 5)(x + 5/2)(x − 5/2)(x − 5)
+ h2 (x)
(5)(5)(−5)(−5)/4
!2
(x + 5)(x + 5/2)(x − 0)(x − 5)
+ h3 (x)
(15)(5)(5)(−5)/8
!2
(x + 5)(x + 5/2)(x − 0)(x − 5/2)
+ h4 (x)
(10)(15)(5)(5)/4
1
Figure – Hermite Interpolation of 1+x2
using 5 equidistant nodes
Comments
1 2xi
i xi f (x)|xi = 1+x2
f 0 (x)|xi = − (1+x2 )2
i i
0 −5.0000 0.0385 0.0148
1 −3.5355 0.0741 0.0388
2 0.0000 1.0000 0.0000
3 3.5355 0.0741 −0.0388
4 5.0000 0.0385 −0.0148
Compute differences xi − xj , i 6= j
Q4
x0 x1 x2 x3 x4 j=0,j6=i
x0 * -1.4645 -5.0000 -8.5355 -10.0000 625.0
x1 1.4645 * -3.5355 -7.0711 -8.5355 -312.5
x2 5.0000 3.5355 * -3.5355 -5.0000 312.5
x3 8.5355 7.0711 3.5355 * -1.4645 -312.5
x4 10.0000 8.5355 5.0000 1.4645 * 625.0
2
(x − x1 )(x − x2 )(x − x3 )(x − x4 )
q0 (x) =
(x0 − x1 )(x0 − x2 )(x0 − x3 )(x0 − x4 )
(x + 3.5355)(x)(x − 3.5355)(x − 5) 2
=
625.0
2
(x − x0 )(x − x2 )(x − x3 )(x − x4 )
q1 (x) =
(x1 − x0 )(x1 − x2 )(x1 − x3 )(x1 − x4 )
(x + 5)(x)(x − 3.5355)(x − 5) 2
=
−312.5
2
(x − x0 )(x − x1 )(x − x3 )(x − x4 )
q2 (x) =
(x2 − x0 )(x2 − x1 )(x2 − x3 )(x2 − x4 )
(x + 5)(x + 3.5355)(x − 3.5355)(x − 5) 2
=
312.5
2
(x − x0 )(x − x1 )(x − x2 )(x − x4 )
q3 (x) =
(x3 − x0 )(x3 − x1 )(x3 − x2 )(x3 − x4 )
(x + 5)(x + 3.5355)x(x − 5) 2
=
−312.5
2
(x − x0 )(x − x1 )(x − x2 )(x − x3 )
q4 (x) =
(x4 − x0 )(x4 − x1 )(x4 − x2 )(x4 − x3 )
(x + 5)(x + 3.5355)x(x − 3.5355) 2
=
625.0
2 2 2 2
q00 (x0 ) = + + + = −2.200
(x0 − x1 ) (x0 − x2 ) (x0 − x3 ) (x0 − x4 )
2 2 2 2
q10 (x1 ) = + + + = 0.282
(x1 − x0 ) (x1 − x2 ) (x1 − x3 ) (x1 − x4 )
2 2 2 2
q20 (x2 ) = + + + = 0.000
(x2 − x0 ) (x2 − x1 ) (x2 − x3 ) (x2 − x4 )
2 2 2 2
q30 (x3 ) = + + + = −0.282
(x3 − x0 ) (x3 − x1 ) (x3 − x2 ) (x3 − x4 )
2 2 2 2
q40 (x4 ) = + + + = 2.200
(x4 − x0 ) (x4 − x1 ) (x4 − x2 ) (x4 − x3 )
h(x) = q0 (x)h0 (x) + q1 (x)h1 (x) + q2 (x)h2 (x) + q3 (x)h3 (x) + q4 (x)h4 (x)
Comments
Recall
1
Figure – Hermite Interpolation of 1+x2
using 5 equidistant nodes
A useful piece of matlab script
What happens if instead of using exact values f (xi ) we consider perturbed values
fˆ(xi ), i = 0, 1, . . . , n. This may be due to uncertainty in the data or truncature errors.
We have
X n n
X
max [f (xi ) − fˆ(xi )]li (x) ≤ max |li (x)| max f (xi ) − fˆ(xi )
x0 ≤x≤xn x0 ≤x≤xn x0 ≤x≤xn
i=1 i=1
Let
n
X
Λn (x) = max |li (x)|
x0 ≤x≤xn
i=1
Exercise
Dessiner t0 , t1 , t2 et t3
{−1.0, −0.7, −0.4}, {−0.4, −0.1, 0.2}, {0.2, 0.5, 0.8}, {0.8, 1.1, 1.4},
{1.4, 1.7, 2.0}
Réponses
Complementary Reading
Contents
1 Présentation du cours
3 Polynomial Interpolation
4 Intégration Numérique
5 Dérivation numérique
Introduction
Nous traitons ici d’intégrales définies. Comme dans le cas de l’interpolation ou de la
dérivation numérique, on peut se retrouver à intégrer :
π 4 X∞
(−9/4)k
Z
3
f (x)dx = π .
0 2 k=0
k!(k + 4)!
Introduction
dy
= f (x), y(x0 ) = 0.
dx
Introduction
We want to find the definite integral
Z b
I= f (x) dx
a
n
X
I(f ) ≈ Î(f ) = hf (x̄1 ) + . . . + hf (x̄n ) = h f (x̄i ), h = (b − a)/n = xi − xi−1
i=1
Valeur exacte
Z 2 2
1 1 1
dx = ln(3x + 4) = (ln(10) − ln(1)) = 0.7675
−1 3x + 4 3 −1 3
et les 5 sous-intervalles
{−0.7, −0.1, 0.5, 1.1, 1.7} et {0.5263, 0.2703, 0.1818, 0.1370, 0.1099}
1 f (xi−1 ) 1 f (xi )
= − (xi−1 − xi )2 + (xi − xi−1 )2
2 xi−1 − xi 2 xi − xi−1
h
= (f (xi−1 ) + f (xi ))
2
Formule du trapèze
We come to the approximation
Formule du trapèze
n
hX
I(f ) ≈ Î(f ) = [f (xi−1 ) + f (xi )]
2 i=1
for the integral over the whole interval [x0 , xn ]. Recall that we have n intervals and
n + 1 nodes x0 , x1 , . . . , xn .
Caution : If we develop the summation above, we must be aware of the fact that the
functions on the interior nodes appear twice, while the functions on the extreme nodes
appear once.
h
Î(f ) = [f (x0 ) + 2f (x1 ) + . . . + 2f (xn−1 ) + f (xn )]
2
Avec n = 5, les 6 noeuds sont −1; −0.4; 0.2; 0, 8; 1.4; 2 et les 5 les valeurs
1
correspondantes de la fonction 3x+4 aux noeuds
Formule du trapèze
Yet another choice. This consists in replacing f (x) with a polynomial of degree 2 at
nodes xi−1 , x̄i = (xi−1 + xi )/2 and xi in each subinterval.
(x − x̄i )(x − xi )
p2 (x) = f (xi−1 )
(xi−1 − x̄i )(xi−1 − xi )
(x − xi−1 )(x − xi )
+ f (x̄i )
(x̄i − xi−1 )(x̄i − xi )
(x − xi−1 )(x − x̄i )
+ f (xi ).
(xi − xi−1 )(xi − x̄i )
Formule de Simpson
We proceed as before. But, now we have for each interval three values xi−1 , xi , x̄i , to
be considered. Nevertheless the integration limits remain the same, that is xi−1 and xi
Z Z
f (xi−1 )
p2 (x)dx = (x − x̄i )(x − xi )dx
(xi−1 − x̄i )(xi−1 − xi )
Z
f (x̄i )
+ (x − xi−1 )(x − xi )dx
(x̄i − xi−1 )(x̄i − xi )
Z
f (xi )
+ (x − xi−1 )(x − x̄i )dx
(xi − xi−1 )(xi − x̄i )
f (xi−1 ) x3 x2
= 2 2
− (xi + x̄i ) + x̄i xi x
h 3 2
f (x̄i ) x3 x2
−4 2 − (xi + xi−1 ) + xi−1 xi x
h 3 2
f (xi ) x3 x2
+2 2 − (x̄i + xi−1 ) + xi−1 x̄i x + cste
h 3 2
Formule de Simpson
Recalling 2 that xi − xi−1 = h, xi − x̄i = h/2, x̄i − xi−1 = h/2, observe that
xi
x3 x2
− (xi + x̄i ) + x̄i xi x = h3 /12
3 2 xi−1
xi
x3 x2
− (xi + xi−1 ) + xi−1 xi x = −h3 /6
3 2 xi−1
xi
x3 x2
− (x̄i + xi−1 ) + xi−1 x̄i x = h3 /12.
3 2 xi−1
Thus
Formule de Simpson
n
hX
Î(f ) = [f (xi−1 ) + 4f (x̄i ) + f (xi )] .
6 i=1
avec n = 5.
Valeur exacte
Z 2
2
1 1 1
dx = ln(3x + 4) = (ln(10) − ln(1)) = 0.7675
−1 3x + 4 3 −1 3
Avec n = 5, les 6 noeuds sont −1; −0.4; 0.2; 0, 8; 1.4; 2 et les 5 sous-intervalles
1
L’ensemble des 5 points milieux et les valeurs correspondantes de la fonction 3x+4
{−0.7, −0.1, 0.5, 1.1, 1.7} et {0.5263, 0.2703, 0.1818, 0.1370, 0.1099}
Proposition
Erreur dans la méthode du point milieu
i
Z
xi + xi−1 1
|f 00 (θ)|h3
f (x)dx − hf ≤ 24 max
i−1 2 θ∈[xi−1 , xi ]
Proposition
Erreur dans la méthode du trapèze
i
Z
f (xi ) + f (xi−1 )
|f 00 (θ)|h3
f (x)dx − h ≤ C θ∈[xmax,
i−1 2 i−1 xi ]
Proposition
Erreur dans la méthode de Simpson
i
Z
h 1
|f (4) (θ)|h5
f (x)dx − [f (xi−1 ) + 4f (x̄i ) + f (xi )] ≤ max
i−1 6 2880 θ∈[xi−1 , xi ]
Présentation du cours Introduction
Rappel sur le Développement en série Middle point (rectangle) formula
Polynomial Interpolation Formule du trapèze
Intégration Numérique Formule de Simpson
Dérivation numérique Equations différentielles ordinaires (EDO). Méthode d’Euler
Equations non-linéaires d’une variable Exos
Calcul numérique approchés et erreurs
Le problème de Cauchy
Le problème est d’approximer trouver une fonction y(t) satisfaisant à une relation dite
équation différentielle ordinaire du 1er ordre comme suit :
Le problème de Cauchy
y0 = f (t, y(t)),
t ≥ t0 ,
y(t0 ) = y0 . condition intiale
Dans l’approche numérique, la solution approchée de y(t) sera sous forme tabulée. Elle
n’est pas une expression analytique.
Le problème de Cauchy
exemple 1
y 0 = −y + 2e−t cos(2t), t0 = 0, y0 = 0
On peut vérifier que la solution exacte (analytique) est y(t) = e−t sin(2t).
Dans la pratique, la solution analytique d’une EDO est rarement accessible ; d’où
l’usage des méthodes numériques.
yi+1 = yi + hf (ti , yi )
yi+1 = yi + hf (ti , yi );
ti+1 = ti + h;
Utilisation de la méthode des rectangle à droite
h
yi+1 = yi + [f (ti , yi ) + f (ti+1 , yi+1 )]
2
Exercice
On demande :
2
De montrer que la fonction y(t) = et −1 vérifie cette relation. On dit que c’est
une solution exacte de l’équation (5).
Solution
Exo recap
analytiquement
numériquement avec 5 noeuds en utilisant les trois méthodes étudiées
Contents
1 Présentation du cours
3 Polynomial Interpolation
4 Intégration Numérique
5 Dérivation numérique
Motivation
Idée
Calculer la dérivée de
sin(x2 ) ln(x)
f (x) = √
x+3
√
en x = π/2
Réponse
√
[2x cos(x2 ) ln(x) + sin(x2 ) x1 ]( x + 3) − sin(x2 ) ln(x) 2√
1
x
f 0 (x) = √
( x + 3)2
Exos
sin(x2 ) ln(x)
Figure – f (x) = √
x+3
Présentation du cours
Rappel sur le Développement en série Introduction
Polynomial Interpolation Dérivation par interpolation
Intégration Numérique Dérivation par Développement de Taylor. Différences finies
Dérivation numérique Extrapolation de Richardson
Equations non-linéaires d’une variable Equations différentielles ordinaires (EDO). Méthode d’Euler
Calcul numérique approchés et erreurs
>> x=s q r t ( p i ) / 2
x =
0.8862
>> a =((2∗ x ∗ c o s ( x ^2)∗ l o g ( x)+ s i n ( x ^2)/ x ) ) ∗ ( s q r t ( x )+3)
a =
2.5481
>> b = s i n ( x ^2)∗ l o g ( x ) ∗ ( 1 / ( 2 ∗ s q r t ( x ) ) )
b =
−0.0454
>> c= ( s q r t ( x )+3)^2
c =
15.5346
>> d = ( a−b ) / c
d=
0.1669
Lorsque la fonction est représentée sous forme tabulée. La dérivée peut être obtenue
par dérivation du polynôme d’interpolation. On obtient alors
Theorem
n
pn (x) l0 (x) l1 (x) ln (x) X li (x)
= y0 + y1 + · · · + yn = yi .
dx dx dx dx i=0
dx
Considérons les deux développements de Taylor à l’ordre 1 d’une fonction deux fois
dérivable
1 00 + 2
f (x + h) = f (x) + f 0 (x)h + f (θ )h , x ≤ θ+ ≤ x + h
2
1
f (x − h) = f (x) − f 0 (x)h + f 00 (θ− )h2 , x − h ≤ θ− ≤ x
2
Formule
Les différences décentrées à droite et à gauche sont, respectivement,
f (x + h) − f (x) f (x) − f (x − h)
f 0 (x) ≈ et f 0 (x) ≈ ,
h h
en négligeant 21 f 00 (θ+ )h2 et 12 f 00 (θ− )h2 . Les erreurs de troncature sont d’ordre 1 en
h et données respectivement par
1 00 + 1 00 −
Et = f (θ ) h et Et = f θ ) h.
2 2
Présentation du cours
Rappel sur le Développement en série Introduction
Polynomial Interpolation Dérivation par interpolation
Intégration Numérique Dérivation par Développement de Taylor. Différences finies
Dérivation numérique Extrapolation de Richardson
Equations non-linéaires d’une variable Equations différentielles ordinaires (EDO). Méthode d’Euler
Calcul numérique approchés et erreurs
>> h =0.01
h =
0.0100
>> p = s i n ( ( x+h ) ^ 2 ) ∗ l o g ( x+h ) / ( s q r t ( x+h )+3)
p =
−0.0200
>> q = s i n ( x ^2)∗ l o g ( x ) / ( s q r t ( x )+3)
q =
−0.0217
>> r =(p−q ) / h
r =
0.1693
1
sin(x + h) = sin(x) + cos(x)h − sin(θ+ )h2 , x ≤ θ+ ≤ x + h
2
1
sin(x − h) = sin(x) − f 0 (x)h + sin(θ− )h2 , x − h ≤ θ− ≤ x
2
Exos
Utiliser les différences décentrées pour les exercices suivants :
ln(x)
Soit f (x) = √
x−1
. Approximer f 0 (x) en x = 2 avec
f˜0 (x)|x=1 fˆ0 (x)|x=1 (f (x) − fˆ0 (x))/f 0 (x)
0
h
x=1
10−2 4.060 3.940
10−2 /2 4.030 3.970
10−2 /4 4.015 3.985
1 000 +
f (x + h) − f (x − h) = 2 f 0 (x)h + f (θ ) + f 000 (θ− ) h3
6
où x ≤ θ+ ≤ x + h et x − h ≤ θ− ≤ x.
Comme f 000 (x) est continue, il existe θ̂ ∈ [θ− , θ+ ] ⊂ [x − h, x + h] tel que
1 000 +
f 000 (θ̂) = f (θ ) + f 000 (θ− ) .
2
Ainsi,
f (x + h) − f (x − h) 1
f 0 (x) = − f 000 (θ̂)h2 .
2h 6
Formule
f (x + h) − f (x − h)
f 0 (x) ≈ .
2h
L’erreur de troncature est donc d’ordre deux en h
1 000
Et = f (θ̂)h2 .
6
Présentation du cours
Rappel sur le Développement en série Introduction
Polynomial Interpolation Dérivation par interpolation
Intégration Numérique Dérivation par Développement de Taylor. Différences finies
Dérivation numérique Extrapolation de Richardson
Equations non-linéaires d’une variable Equations différentielles ordinaires (EDO). Méthode d’Euler
Calcul numérique approchés et erreurs
(x + h)4 − (x − h)4
f 0 (x) ≈ f˜0 (x) =
2h
f˜0 (x)|x=1 (f (x) − f˜0 (x))/f 0 (x)
0
h
x=1
10−2 4.00040 0.000100
10−2 /2 4.00010 0.000025
10−2 /4 4.00002 0.000005
ln(x+h) ln(x−h)
√
x+h−1
− √
x−h−1
f 0 (x) ≈ f˜0 (x) =
2h
f˜0 (x)|x=2 (f (x) − f˜0 (x))/f 0 (x)
0
h
x=2
10−2 ∗ ∗
10−2 /2 ∗ ∗
10−2 /4 ∗ ∗
Différence centrée d’ordre 4
Exercice : A partir des développement suivants
1 00 1
f (x + 2h) = f (x) + f 0 (x)(2h) + f (x)(2h)2 + f 000 (x)(2h)3
2! 3!
1 1
+ f (4) (x)(2h)4 + f (5) (θ̂)(2h)5 , x ≤ θ̂ ≤ x + 2h (1)
4! 5!
1 1
f (x − 2h) = f (x) − f 0 (x)(2h) + f 00 (x)(2h)2 − f 000 (x)(2h)3
2! 3!
1 (4) 4 1 (5) 5
+ f (x)(2h) − f (θ̄)(2h) , x − 2x ≤ θ̂ ≤ x (2)
4! 5!
1 1
f (x + h) = f (x) + f 0 (x)h + f 00 (x)h2 + f 000 (x)h3
2! 3!
1 1
+ f (4) (x)h4 + f (5) (ξ̂)h5 , x ≤ ξ̂ ≤ x + h (3)
4! 5!
1 1
f (x − h) = f (x) − f 0 (x)h + f 00 (x)h2 − f 000 (x)h3
2! 3!
1 1
+ f (4) (x)h4 − f (5) (ξ̄)h5 , x − h ≤ ξ̄ ≤ x (4)
4! 5!
faire la combinaison des équations ci-dessus (2) − (1) − 8[(4) − (3)] et obtenir
Proposition
f (x − 2h) − 8f (x − h) + 8f (x + h) − f (x + 2h)
f 0 (x) ≈
12h
avec l’erreur de troncature
1 (5)
Et = |f (θ)|h4
30
1
Et ≤ max |f (5) (θ)|h4
30 x−2h≤θ≤x+2h
f (x − 2h) − 8f (x − h) + 8f (x + h) − f (x + 2h)
f 0 (x) ≈ f˜0 (x) =
12h
0
f (x)−f˜0 (x)
h f˜0 (x)|x=1 f 0 (x)
x=1
10−2 4.000000000000002 ∗
10−2 /2 3.999999999999945 ∗
10−2 /4 3.999999999999990 ∗
Exemples :
Commentaires
On notera que des valeurs trop petites de h peuvent créer de l’instabilité numérique. Il
y a une limite dans l’utilisation de petites valeurs de h.
Dérivée seconde
L’addition des développements de f (x + h) et f (x − h) à l’ordre 3 donne
" #
1 f (4) (θ+ ) + f (4) (θ− )
f (x + h) + f (x − h) = 2f (x) + f 00 (x)h2 + h4
12 2
qui conduit à
Formule
on obtient
f (x + h) − 2f (x) + f (x − h)
f 00 (x) ≈ ,
h2
1 (4)
en négligeant 12
f (θ)h4 . L’erreur de troncature est donc
1 (4)
Et = f (θ)h2 .
12
Sources d’erreurs
Les erreurs dans le calcul numérique proviennent de plusieurs sources. Ce qui conduit
aux erreurs de
Principe
Soient deux approximations de la dérivée de f (x) avec comme pas h et h/2, resp.
f (x + h) − f (x) 1 00
f˜h0 ≡ = f 0 (x) + f (x)h + c1 h2 + . . .
h 2
0 f (x + h/2) − f (x) 1 00
f˜h/2 ≡ = f 0 (x) + f (x)(h/2) + c1 (h/2)2 + . . .
h/2 2
Dans les deux cas, l’erreur est dominée par les termes linéaires en h.
2f˜h/2
0 − f˜h0 2c1 (h/2)2 − c1 h2
= f 0 (x) + + ...
2−1 2−1
Extrapolation de Richardson
f (x + h) − f (x − h) 1
f˜h0 ≡ = f 0 (x) + f 000 (x)h2 + c1 h3 + . . .
2h 3
0 f (x + h/2) − f (x − h/2) 1
f˜h/2 ≡ = f 0 (x) + f 000 (x)(h/2)2 + c1 (h/2)3 + . . .
2(h/2) 3
4f˜h/2
0 − f˜h0 4c1 (h/2)3 − c1 h3
= f 0 (x) + +
4−1 4−1
h f˜0 (π/6) fˆ0 (x) ẽh = |f 0 (π/6) − f˜0 (π/6)| êh = |f 0 (π/6) − fˆ0 (π/6)|
10−1 ∗ ∗ ∗ ∗
10−2 ∗ ∗ ∗ ∗
10−3 ∗ ∗ ∗ ∗
10−4 ∗ ∗ ∗ ∗
Le problème de Cauchy
Le problème est d’approximer trouver une fonction y(t) satisfaisant à une relation dite
équation différentielle ordinaire du 1er ordre comme suit :
Le problème de Cauchy
y0 = f (t, y(t)),
t ≥ t0 ,
y(t0 ) = y0 . condition intiale
Dans l’approche numérique, la solution approchée de y(t) sera sous forme tabulée. Elle
n’est pas une expression analytique.
Le problème de Cauchy
exemple 1
y 0 = −y + 2e−t cos(2t), t0 = 0, y0 = 0
On peut vérifier que la solution exacte (analytique) est y(t) = e−t sin(2t).
Dans la pratique, la solution analytique d’une EDO est rarement accessible ; d’où
l’usage des méthodes numériques.
1 2 00
y(ti + h) = y(ti ) + hy 0 (ti ) + h y (ξ), ti ≤ ξ ≤ ti + h, i = 0, 1, . . .
2
on approxime les valeurs exactes y(ti+1 ) par les valeurs approchées notées yi+1 en
négligeant 12 h2 y 00 (ξ) selon le schéma ci-dessous
yi+1 = yi + hf (ti , yi );
ti+1 = ti + h;
Présentation du cours
Rappel sur le Développement en série Introduction
Polynomial Interpolation Dérivation par interpolation
Intégration Numérique Dérivation par Développement de Taylor. Différences finies
Dérivation numérique Extrapolation de Richardson
Equations non-linéaires d’une variable Equations différentielles ordinaires (EDO). Méthode d’Euler
Calcul numérique approchés et erreurs
Exercice
On demande :
2
De montrer que la fonction y(t) = et −1 vérifie cette relation. On dit que c’est
une solution exacte de l’équation (5).
Solution
Contents
1 Présentation du cours
3 Polynomial Interpolation
4 Intégration Numérique
5 Dérivation numérique
Définition
Une équation non-linéaire est une équation qui peut se mettre sous la forme
f (x) = 0,
Exemples
f (x) = c
f (x) = ax + b
f (x) = ax2 + bx + c
Méthode de la dichotomie
Algorithme
On retient [a, (a + b)/2] si f ((a + b)/2) a le même signe que f (b), sinon on
retient [(a + b)/2, b] pour nouvel intervalle
On itère le processus
Méthode de dichotomie
x̃ = 1.8900.
On voit que f (x̄) tend vers 0 alors que le point milieu s’approche de la racine.
Convergence
au départ : |b − a|/2,
à l’itération i : |b − a|/2i .
Méthode de Newton
La fonction f (x) est continue sur l’intervalle [a, b] supposé contenir la solution
La fonction f (x) est strictement monotone sur l’intervalle [a, b]
f (a) · f (b) < 0
f (x) est dérivable et f 0 (x) 6= 0 sur [a, b]
1 00
On néglige 2
f (θ)h2 et on cherche la valeur de hi qui annule l’approximation
f (xi ) + f 0 (xi )h
f (xi )
hi = − ,
f 0 (xi )
xi+1 = xi + hi ,
avec x0 donné.
Présentation du cours
Rappel sur le Développement en série Introduction
Polynomial Interpolation Méthode de la dichotomie
Intégration Numérique Méthode de Newton
Dérivation numérique Méthode de la sécante
Equations non-linéaires d’une variable Méthode du point fixe
Calcul numérique approchés et erreurs
Exo
avec x0 = π, x0 = π/2
Exo
f (xi )
hi = −
f 0 (xi )
xi+1 = xi + h,
x = pi ;
X = [];
f o r ( i =1:6)
x = x −( s i n ( x ) −0.5∗ x ) / ( c o s ( x)− 0 . 5 ) ;
X = [X, x ] ;
end ;
X
Exo
Méthode de la tangente
Exo
f (x) = x3 − 4x + 1
avec x0 = −2, x0 = 0 et x0 = 2
Convergence
f (x, y) = 0
g(x, y) = 0
" ∂f ∂f
#−1
xk+1 xk ∂x ∂y f
= − ∂g ∂g
yk+1 yk g (xk ,yk )
∂x ∂y (xk ,yk )
1 T 2
f (x + h) = f (x) + ∇f (x)T h + h ∇ h + o(khk2 )
2
−1
∂2f ∂f ∂f
" #
∂f
xk+1 xk ∂x2 ∂x ∂y ∂x
= − ∂2f
∂f
yk+1 yk ∂f ∂f
∂y
∂y ∂x ∂y 2 (xk ,yk ) (xk ,yk )
On remplace alors dans la méthode de Newton f 0 (x) par une approximation par
différence finie à gauche.
1 00 − 2
f (x − h) = f (x) − f 0 (x)h + f (θ )h , x − h ≤ θ− ≤ x
2
f (x) − f (x − h)
f 0 (x) ≈
h
Ainsi, les itérations de Newton se transforment en
xi − xi−1
hi = xi − f (xi )
f (xi ) − f (xi−1 )
xi+1 = xi + hi
Définition
x∗ = φ(x∗ )
Théorème
xk+1 = φ(xk )
Convergence
Vitesse de convergence
On a :
|xk+1 − x∗ | = |φ(xk ) − φ(x∗ )| ≤ L|xk − x∗ | ≤ Lk+1 |x0 − x∗ |
Interprétation géométrique
Exemple
Contents
1 Présentation du cours
3 Polynomial Interpolation
4 Intégration Numérique
5 Dérivation numérique
Codage
Dans un ordinateur, un nombre réel x est codé sous la forme
x ≈ m × bp ,
PN
m = 0, a1 , a2 · · · aN = ak b−k , avec a1 = 1, d’où b−1 ≤ m < 1
k=1
PN −1
m = a0 , a1 , a2 · · · aN −1 = k=1 ak b−k , avec a0 = 1 , d’où 1 ≤ m < b
Précision relative
Précision relative
∆x b−N
≤ −1
x b
Faire (x + y) + z puis x + (y + z)
Remarque
L’addition est non associative par suite des erreurs d’arrondis.
Règle
Dans une sommation des reels, il convient de sommer en premier les termes ayant la
plus petite valeur absolue
Méthode naïve
xk = xk−1 · x,
uk = ak · xk ,
sk = sk−1 + uk
pn = an , Puis pour k = n, n − 1, . . . 1
Précision
La précision de la méthode de Hörner sera nettement meilleure si le terme |ak ||x|k
décroit rapidement.