Académique Documents
Professionnel Documents
Culture Documents
04syslindirect PDF
04syslindirect PDF
Méthodes numériques
pour l’ingénieur
Résolution de systèmes linéaires
par des méthodes directes :
Gauss, LU,
Ax=b : un cas simple
A est une matrice diagonale
problème
a11 0 0 0 x1 b1
solution
0 0
0 0 x =b bi
0 aii 0
i i xi = , i ∈ [1, n]
aii
0 0
0 0 0 ann x b
n n
Algorithme
Fonction x = diago(A,b)
pour i = 1 jusqu' à n
b
xi ← i
aii
fait
A est de forme triangulaire
a11 0 0 0 x1 b1
b1
0 x1 = a
a aii 0 0 x =b
1
i1 i i 1 i −1
xi = bi − ∑ aij x j
0 aii j =1
a ani ann x b
n1 n n somme
b1
Fonction x = triang(A,b) x1 ←
a11
pour i = 2 jusqu' à n
somme ← bi
pour j = 1 jusqu' à i − 1
somme ← somme − aij x j
fait
somme
xi ←
aii
fait
Commentaires sur le programme « diago »
• Complexité ?
n
• Déterminant : det( A) = ∏ aii
i =1
2. permute 2 colonnes
3. divise par un même terme non nul les éléments d’une ligne
2 x1 + 4 x2 − 2 x3 = −6
0 + x + x3 + x4 = 3
2
3x1 − x2 + x3 + 2 x4 = 8
− x2 + 2 x3 + x4 = 6
Pivot de Gauss : un exemple
2 x1 + 4 x2 − 2 x3 = −6
x + 3x + x4 = 0
1 2
3x1 − x2 + x3 + 2 x4 = 8
− x2 + 2 x3 + x4 = 6
(3) = (3)-a31/pivot (1)
2 x1 + 4 x2 − 2 x3 = −6
0 + x2 + x3 + x4 = 3
0 − 7 x2 + 4 x3 + 2 x4 = 17
− x2 + 2 x3 + x4 = 6
i i 1 n
xi = bi − ∑ aij x j
0 aii j =i +1
0 0 0 ann x b
n n somme
bn
Fonction x = triang(A,b) xn ←
ann
pour i = n − 1 jusqu' à 1
somme ← bi
pour j = i + 1 jusqu' à n
somme ← somme − aij x j
fait
somme
xi ←
aii
fait
Gauss
Fonction x = Gauss(A,b)
U,c = descent(A,b)
x = triang(U,c)
Remarques
Choix du pivot : minimiser les erreurs d’arrondis
si un pivot est nul, on permute deux lignes
si tous les pivots restant sont nuls la matrice est singulière
(i.e. le système d’équations n’admet pas de solution unique)
10 −4 1 1
pivot : 10 −4 , x =
−4 −4
0 1 − 10 2 − 10
10 −4 1 1
pivot : 10 −4 , x =
4 4
0 1 − 10 2 − 10
( k +1) a (k )
ij
a ← a (k )
ij − ik
a (k )
( k ) kj
pour j = k + 1,..., n
akk
pour i = k + 1,..., n (k )
a
b ( k +1) ← b ( k ) − ik b ( k )
i i (k ) k
akk
matriciellement : A( k +1) = M ( k ) A( k ) ; b ( k +1) = M ( k )b ( k ) ;
Les cas du second membre b
b1( k +1) ← b1( k ) mik = −
aik
;
( k +1) akk
bk ← bk( k )
(k ) 1 0 0 0
a
bk( k+1+1) ← bk( k+1) − k (+k1,)k bk( k ) 0 M(k)
1 0 0
akk ?
(k ) M (k ) = 0 0 1
a
bi( k +1) ← bi( k ) − ik( k ) bk( k )
akk mk +1,k 0
0 0 m
a (k )
0 1
bn( k +1) ← bn( k ) − nk (k ) n,k
(k ) k
b
akk
matriciellement : b ( k +1) = M ( k )b ( k ) ;
Les cas du second membre b
b1( k +1) ← b1( k ) mik = −
aik
;
( k +1) akk
bk ← bk( k )
(k ) 1 0 0 0
a
bk( k+1+1) ← bk( k+1) − k (+k1,)k bk( k ) 0 1 0 0
akk
(k ) M (k ) = 0 0 1
a
bi( k +1) ← bi( k ) − ik( k ) bk( k )
akk mk +1,k 0
0 0 m
a (k )
0 1
bn( k +1) ← bn( k ) − nk (k ) n,k
(k ) k
b
akk
matriciellement : b ( k +1) = M ( k )b ( k ) ;
Factorisation
matriciellement : A( k +1) = M ( k ) A( k ) ; b ( k +1) = M ( k )b ( k ) ;
1 0 0 0
0 1 0 0
aik
mik = − ; M (k ) = 0 0 1
akk
mk +1,k 0
0 0 m 0 1
n ,k
U = A( n ) = M ( n −1) A( n −1)
= M ( n −1) M ( n −2) A( n −2)
( n −1) ( n−2)
=M M
...M ( 2)
M (1)
A
M
= M A ⇔ A = M −1U
en posant L = M −1 on a A = LU
LU : motivation
On connaît la matrice A
comment « préparer A » ?
LU : principe
Il est si facile le résoudre un système « triangulaire » !
A = LU
(1) Ly = b
Ax = b ⇔
(2) Ux = y
U
0
Comment construire Let U ?
idée :
0 reprendre l’étape de triangularisation
A de la méthode de Gauss
L
De Gauss à LU
Représentons une étape de la triangularisation
par la multiplication de A par une matrice M(k)
A( k +1) = M ( k ) A( k ) A(1) = A et A( n ) = U
aik
i ,k = = − mi ,k
akk
aik
bi ← bi − a bk 1 0 0
kk
a 0
aij ← aij − ik akj
akk M (k ) = 0 0 1 0
gauss − k +1,k
0 − n ,k 0 1
( n −1)
U =M ...M ...M A = MA
(k ) (1)
A = M −1U = LU
donc L = M −1
LU : la décomposition
Les matrices élémentaires M(k) sont inversibles
et leurs inverses sont les matrices L(k) triangulaires inférieures
telles que :
lij = 0
L( k ) = sauf lii = 1 i = 1, n (
L( k ) = I − M ( k ) − I )
sauf l = i = k + 1,n
ik ik
1 0 0 1 0 0
0
0
M (k ) = 0 0 1 0 L( k ) = 0 0 1 0
− k +1,k k +1,k
0 − n ,k 0 1 0
n ,k 0 1
1 2 1 1 1 2
1
2 2 1 = 2 1 − 2 − 1
1 1 1 1 1 1 1
2 2
LU : l’algorithme
Fonction x = LU(A,b)
L,U = decompose(A)
y = triang(L,b)
x = triang(U,y)
A=LU
Théorème : Si au cours de l’élimination de Gauss sur la matrice A,
les pivots sont non nuls,
alors il existe une matrice triangulaire inférieure L
et une matrice triangulaire supérieure U, telle que :
A = LU
si de plus on impose à L d’avoir les éléments diagonaux
égaux à un
alors la factorisation est unique
Démonstration : (éléments) U = M ( n −1) ...M ( k ) ...M (1) A = MA
A = M −1U = LU
unicité : par l’absurde
Remarque : (déterminent) n n
det( A) = det( LU ) = det( L) det(U ) = det(U ) = ∏ uii =∏ pivot i
i =1 i =1
A=LU
Théorème : Si au cours de l’élimination de Gauss sur la matrice A,
les pivots sont non nuls,
alors il existe une matrice triangulaire inférieure L
et une matrice triangulaire supérieure U, telle que :
A = LU
si de plus on impose à L d’avoir les éléments diagonaux
égaux à un
alors la factorisation est unique
Contre exemple trivial :
0 2
A=
1 1
Réorganisation du système linéaire :
permutation des lignes et des colonnes
RECHERCHE DU MEILLEUR PIVOT
La factorisation
PA=LU
Définition : Si la matrice A, est non singulière
alors il existe une matrice de permutation P
telle que les pivots de PA sont non nuls. (TL chapitre 4)