Documente Academic
Documente Profesional
Documente Cultură
Rezolvarea numerică a
sistemelor algebrice liniare (II)
ȘL.dr.ing. Aurel Sorin Lup, As.drd.ing. Mihai Popescu
A.-S. Lup L4. Metode iterative de rezolvare a sist. alg. lin. 01/11/2021 3/13
Principiul metodelor iterative.
Metode iterative: Metode de rezolvare a sistemelor algebrice liniare bazate pe construirea
unui șir de soluții care se dorește să tindă la soluția exactă.
k-1
K=2
k
K=1
x(k-1)
A.-S. Lup L4. Metode iterative de rezolvare a sist. alg. lin. 01/11/2021 5/13
Evoluția procesului iterativ
F(x)
➢ Oprirea procesului iterativ
F(x)
x(k) = F(x(k-1)) • Eroare maximă impusă
x(k-1) = F(x(k-2)) 𝑥 𝑘 − 𝑥 𝑘−1 ≤ 𝜀
x(3) = F(x(2))
• Numărul maxim de iterații
x(2) = F(x(1)) 𝑘 ≤ 𝑛𝑖𝑡max
➢ Teoreme de convergență
o 𝜌(𝑀) < 1 ⇒ 𝜌 𝑀 = max[𝜆𝑘 ]
x(1) = F(x(0))
o 𝑀 ≤ 1 ⇒ 𝜌(𝑀) < 1
K=3
k-1
K=2
k
o A – diagonal dominantă
K=1
⇒ 𝑀 ≤ 1 ⇒ 𝜌(𝑀) < 1
x(k-1)
A.-S. Lup L4. Metode iterative de rezolvare a sist. alg. lin. 01/11/2021 6/13
Pseudocodul general
Citește A, b, n, err_adm, kmax
;soluția este stocată în x_nou
x_nou =x_0 ;inițializare
k=0
Repetă
k=k+1
x_vechi=x_nou
x_nou = rezolvare(A, b, n, x_vechi); x_k=F(x_(k-1))
err = calcul_eroare(x_nou, x_vechi, n)
Până când (err<=err_adm) sau (k>=kmax)
Afișează x_nou
A.-S. Lup L4. Metode iterative de rezolvare a sist. alg. lin. 01/11/2021 7/13
Metoda iterativă Jacobi
F se obține prin partiționarea matricei A = L + D + U
(L+D+U)x =b
𝟐 𝟎 𝟏 𝟎 𝟎 𝟎 2 0 0 0 0 1
𝟏 𝟏 𝟏 = 𝟏 𝟎 𝟎 + 0 1 0 + 0 0 1 Dx = -(L+U)x +b
𝟎 𝟏 𝟑 𝟎 𝟏 𝟎 0 0 3 0 0 0
D x (k) = - ( L + U ) x (k-1) + b
𝒏
(𝒏𝒐𝒖) (𝒗𝒆𝒄𝒉𝒊) B = D; C = -(L+U) M = -D-1(L+U)
𝒂 𝒊𝒊𝒙 𝒊 = 𝒃𝒊 − 𝒂 𝒊𝒋𝒙 𝒋
𝒊=𝟏,𝒊≠𝒋 x(vechi) = [1,...i-1, i+1..., n]
𝒏
(𝒏𝒐𝒖) 𝒗 (𝒗𝒆𝒄𝒉𝒊)
𝒙 𝒊 = 𝑭𝒊 𝑿 = 𝒃𝒊 − 𝒂 𝒊𝒋𝒙 𝒋 / 𝒂 𝒊𝒊
𝒋=𝟏,𝒊≠𝒋
A.-S. Lup L4. Metode iterative de rezolvare a sist. alg. lin. 01/11/2021 8/13
Metoda iterativă Gauss-Seidel
F se obține prin partiționarea matricei A = L + D + U
𝟐 𝟎 𝟏 𝟎 𝟎 𝟎 2 0 0 0 0 1 (L+D+U)x =b
𝟏 𝟏 𝟏 = 𝟏 𝟎 𝟎 + 0 1 0 + 0 0 1
0 0 3 0 0 0 (L+D)x = -Ux +b
𝟎 𝟏 𝟑 𝟎 𝟏 𝟎
( L + D ) x (k) = - U x (k-1) + b
𝒊−𝟏 𝒏
(𝒏𝒐𝒖) (𝒏𝒐𝒖) (𝒗𝒆𝒄𝒉𝒊)
B = D + L; C = -U
𝒂 𝒊𝒋𝒙 𝒋 + 𝒂 𝒊𝒊𝒙 𝒊 = 𝒃𝒊 − 𝒂 𝒊𝒋𝒙 𝒋
M = -(L+D)-1U
𝒋=𝟏 𝒋=𝒊+𝟏
x(vechi) = x(it_anterioară)[ i+1,..., n]
x(nou) = x(it_curentă) [ 1,..., i-1]
𝒊−𝟏 𝒏
(𝒏𝒐𝒖) 𝒗 (𝒏𝒐𝒖) (𝒗𝒆𝒄𝒉𝒊)
𝒙𝒊 = 𝑭 𝒊 𝑿 = 𝒃𝒊 − 𝒂 𝒊𝒋𝒙 𝒋 − 𝒂 𝒊𝒋𝒙 𝒋 /𝒂 𝒊𝒊
𝒋=𝟏 𝒋=𝒊+𝟏
A.-S. Lup L4. Metode iterative de rezolvare a sist. alg. lin. 01/11/2021 9/13
Exemplu de calcul
𝒊−𝟏 𝒏 𝒏
5𝑥1 + 3𝑥𝒙2( 𝒏 𝒐=𝒖 )−=2 (𝒏𝒐𝒖)
𝒃𝒙𝒊 𝒊𝑥 0−== 0 𝒂𝒃 𝒙−
(𝒏𝒐𝒖)
− 𝒂
( 𝒗 𝒆 𝒄 𝒉 (𝒊 𝒗) 𝒆 𝒄 𝒉 𝒊 )
ቊ 𝒊 𝑥 =
𝒊 𝒋𝒊0 𝒋 𝑥 = −1, 𝒊1𝒋 𝒋𝒂 𝒊 𝒋 𝒙 𝒋
𝒙T / 𝒂 𝒊𝒊 / 𝒂 𝒊𝒊
−2𝑥1 + 3𝑥2 = 5 1 2
𝒋=𝟏 𝒋 = 𝟏 , 𝒊 ≠ 𝒋𝒋 = 𝒊 + 𝟏
Metoda Jacobi Metoda Gauss - Seidel
5𝑥1 + 3𝑥2 = − 2 5𝑥1 + 3𝑥2 = − 2
ቊ ቊ
−2𝑥1 + 3𝑥2 = 5 −2𝑥1 + 3𝑥2 = 5
𝑘 𝑘−1 𝑘 𝑘−1
5𝑥1 + 3𝑥2 = −2 5𝑥1 + 3𝑥2 = −2
ቐ ቐ 𝑘 𝑘
𝑘−1 𝑘 −2𝑥1 + 3𝑥2 = 5
−2𝑥1 + 3𝑥2 = 5
𝑘−1 𝑘−1
𝑘 −2 − 3𝑥2 𝑘 −2 − 3𝑥2
𝑥1 = 𝑥1 =
5 5
𝑘−1 𝑘
𝑘 5 − (−2)𝑥1 𝑘 5 − (−2)𝑥1
𝑥2 = 𝑥2 =
3 3
A.-S. Lup L4. Metode iterative de rezolvare a sist. alg. lin. 01/11/2021 10/13
Exemplu de calcul
Metoda Jacobi Metoda Gauss - Seidel
𝑘−1 𝑘−1
𝑘 −2 − 3𝑥2 𝑘 −2 − 3𝑥2
𝑥1 = 𝑥1 =
5 5
𝑘−1 𝑘
𝑘 5 − (−2)𝑥1 𝑘 5 − (−2)𝑥1
𝑥2 = 𝑥2 =
3 3
0 0
1 −2 − 3𝑥2 2 1 −2 − 3𝑥2 2
𝑥1 = = − = −0,4 𝑥1 = = − = −0,4
5 5 5 5
𝑘=1 0 𝑘=1 5 − (−2)𝑥1
1
4,2
1 5 − (−2)𝑥1 5 1
𝑥2 = = = 1,67 𝑥2 = = = 1,4
3 3 3 3
1 1
2 −2 − 3𝑥2 7,01 2 −2 − 3𝑥2 6,2
𝑥1 = =− = −1,4 𝑥1 = =− = −1,24
5 5 5 5
𝑘=2 1
𝑘=2 2
2 5 − (−2)𝑥1 4,2 2 5 − (−2)𝑥1 2,52
𝑥2 = = = 1,4 𝑥2 = = = 0,84
3 3 3 3
A.-S. Lup L4. Metode iterative de rezolvare a sist. alg. lin. 01/11/2021 11/13
Complexitatea algoritmilor. Erori.
• Timp
➢ J: T = O(𝑚𝑛2 )
➢ GS: T = O(𝑚𝑛2 )
• Memorie
➢ J: T = O(𝑛2 + 3𝑛)
➢ GS: T = O(𝑛2 + 2𝑛)
• Erori
➢ Rotunjire
➢ Trunchiere
➢ Inerente
A.-S. Lup L4. Metode iterative de rezolvare a sist. alg. lin. 01/11/2021 12/13
Referințe
[1] Gabriela Ciuprina, Mihai Rebican, Daniel Ioan - Metode numerice în ingineria electrică -
Îndrumar de laborator pentru studenții facultății de Inginerie Electrică, Editura Printech,
2013, ISBN 978-606-23-0077-7
[2] Gabriela Ciuprina - Notițe de curs, disponibile online pe platforma de moodle
[3] Mihai Rebican - Notițe de curs, disponibile online pe platforma de moodle
A.-S. Lup L4. Metode iterative de rezolvare a sist. alg. lin. 01/11/2021 13/13