Sunteți pe pagina 1din 44

Metode numerice pentru ecuatii neliniare

Metoda bisectiei
Exemplul -1.1 S
a se aproximeze solutia ecuatiei x3 + 4x2 10 = 0 (continut
a n
intervalul [1, 2]).

Solutie Avem
a0 = a = 1, b0 = b = 2, f(a) = 7, f(b) = 14.
Atunci c0 = (a0 + b0 )/2 = 1/2. Cum f(c0 ) < 0 rezulta ca
a1 = c0 = 1/2, b1 = b0 = 2, c1 = (a1 + b1 ) /2 = 5/4 = 1, 25
Cum f (c1) < 0 rezult
a c
a
a2 = c1 = 5/4, b2 = b1 = 2, c2 = (a2 + b2) /2 = 13/8 = 1, 625
Cum f (c2) > 0 rezulta ca
a3 = a2 = 5/4, b3 = c2 = 13/8, c3 = (a3 + b3 ) /2 = 23/16 = 1, 4375
Cum f (c3) > 0 rezult
a c
a
a4 = a3 = 5/4, b4 = c3 = 23/16, c4 = (a4 + b4 ) /2 = 43/32 = 1, 34375
etc.

Regula falsi

Exemplul -1.2 S
a se aproximeze solutia ecuatiei x3 + 4x2 10 = 0 (continut
a n
intervalul [1, 2]).
1

Solutie Avem
a0 = a = 1, b0 = b = 2, f(a) = 7, f(b) = 14.
Atunci c0 = (a0f (b0) b0 f(a0))/(f(b0) f (a0 ) = 0. Cum f(c0 ) < 0 rezulta ca
a1 = c0 = 0, b1 = b0 = 2, c1 = (a1 f(b1 ) b1 f(a1 ))/(f(b1 ) f(a1) = 5/6 = 0, 83333
Cum f (c1) < 0 rezulta ca
a2 = c1 = 5/6, b2 = b1 = 2, c2 = (a2 f(b2 )b2 f(a2))/(f(b2)f (a2 ) = 110/91 = 1, 20879
etc.

Metoda coardei
Exemplul -1.3 S
a se aproximeze solutia ecuatiei 2x3 4x + 1 = 0 (continuta n
intervalul [1/4, 1]), folosind metoda coardei.

Solutie: Fie f(x) = 2x3 4x + 1. Avem: f  (x) = 6x2 8x si f (x) = 12x. Luam
a = 1/4 si b = 1. Evident, f  nu se anuleaza pe [a, b], f(a) f  (a) = 3/32 > 0 si
f(a) f (b) = 1/32 < 0. Deci conditiile de aplicabilitate ale metodei coardei sunt
indeplinite. Luam x0 = 1/4 si x1 = 1. Atunci

x2 =

x0 f(x1 ) x1 f(x0 )
3
x0 f(x3 ) x3 f(x0 )
899
= , x3 =
=
, etc.
f(x1 ) f(x0)
11
f(x3 ) f(x0)
3475

Metoda secantei

Exemplul -1.4 S
a se aplice metoda secantei pe intervalul [0, 1] pentru rezolvarea ecuatiei
3ex 4 cos x = 0 pentru x0 = 1 si x1 = 0, 9.
2

Solutie: Evident f este de dou


a ori derivabil
a pe [0, 1] si f(x) = 3ex + 4 sin x, ,
functie care evident nu se anuleaz
a pe [0, 1]. Cum f(0) f(1) = 3e + 4 cos 1 < 0
rezulta ca ecuatia are o radacina n intervalul [0, 1].
Avem

x2 :=

x0f (x1 ) x1f (x0 )


3e9/10 4 cos(9/10) 9/10(3e 4 cos 1)
=
= 0, 45575
f (x1 ) f(x0 )
3e9/10 4 cos(9/10) 3e + 4 cos 1

Metoda lui Newton

Exemplul -1.5 Sa
se arate ca se aplica metoda lui Newton pe intervalul [0, 1] pentru
rezolvarea ecuatiei 3ex 4 cos x = 0. Lund x0 = 1, s
a se calculeze valoarea primei
iteratii.
Solutie: Evident f este de dou
a ori derivabil
a pe [0, 1] si f (x) = 3ex + 4 sin x,
f(x) = 3ex + 4 cos x, functii care evident nu se anuleaza pe [0, 1]. Cum f (0) f(1) =
3e + 4 cos 1 < 0 si f(1) f(1) = 9e2 16 cos 1 > 0, rezulta ca metoda lui Newton se
aplic
a.
Avem

x1 := x0

f(x0 )
3e 4 cos 1
4 sin 1 + 4 cos 1
=1
=
= 0, 47975
f (x0 )
3e + 4 sin 1
3e + 4 sin 1

Principiul contractiei
Exemplul -1.6 Fie functia


3 1
7
f : , R, f (x) = x2 + x
4 2
16
Sa se arate c
a f este o contractie. Lund x0 = 58 , sa se determine num
arul de iteratii
necesari pentru a aproxima solutia ecuatiei f(x) = x cu o eroare .
3

Solutie Functia f este derivabil


a si
f  (x) = 2x + 1
Avem


3
max |f (x)| = max |2x + 1| = max (2x 1) = 2
4
x[ 34 , 12 ]
x[ 43 , 12 ]
x[ 34 , 12 ]


1=

1
2

Deci
1
|f  (x)| q := .
2
Notam a = 43 , b = 12 . Atunci
 

  






a
+
b
a
+
b
b

a
5
5
1 1
f
 (1 q)

f
+  (1 )


2
2
2
8
8
2 8



 25 5
7
5
1
3
4
+ 

, ceea ce este adevarat.



64 8 16 8
16
64
64

Deci f este o contractie. Fie z solutia ecuatiei f (x) = x pe intervalul [a, b].
Din formula de evaluare a erorii avem
qn
|xn z|
|x1 x0|
1q
Daca

qn
|x1 x0 | , atunci |xn z| , deci xn aproximeaz
a pe z cu eroarea .
1q
Avem

si

Atunci

 
5
25 5
7
43
x1 = f(x0) = f
=

=
8
64 8 16
64


 43 5 
3
|x1 x0 | =  +  =
64 8
64

 1 n
qn
3
3
|x1 x0 | 2 1
n+5
1q
2
1 2 64
4

n+5

3
n log2

 
3
5

Deci putem lua



 
3
n = log2
4, unde [] reprezint
a partea ntreag
a.

Metode pentru rezolvarea sau aproximarea


solutiilor sistemelor de ecuatii liniare
Norme de vectori si norme de matrici
Exemplul -1.7 Fie

1 2 3

A = 4 5 6

7 8 9

Atunci

A
1 = max

1j3

3

i=1

|aij | =

= max (|1| + |4| + |7| , |2| + |5| + |8| , |3| + |6| + |9|) = max (12, 15, 18) = 18
si

A
= max

1i3

3

j=1

|aij | =

= max (|1| + |2| + |3| , |4| + |5| + |6| , |7| + |8| + |9|) = max (6, 15, 24) = 24.

Conditionarea unui sistem de ecuatii liniare


Exemplul -1.8

10 7 8 7

7 5 6 5

A=
8 6 10 9

7 5 9 10

32

23

b=

33

31
5

cu solutia

1

1

x=
1


1

Consider
am sistemul perturbat

10

A=
8

A(x + x) = b + b unde

7 8 7

5 6 5

b
+
b
=

6 10 9

5 9 10

9, 2

12, 6

cu solutia x + x =
4, 5

1, 1

32, 1

22, 9

33, 1

30, 9

Consideram si sistemul perturbat (A + A)(x + x) = b unde

7
8, 1 7, 2
32
10

23
7, 08 5, 04
6
5

A=
b=
33
8
5, 98 9, 89
9

30
6, 99 4, 99
9
9, 98

(1)

81

137

cu solutia x + x =

34

22
Exemplul -1.9 Sa se arate ca

x
x

(2)

= cond(A) b
(Vom considera cazul sistemului
b

(1) si vom lucra cu norma infinit).


Avem:

x
=
x + x x
=
(9, 2 1; 12, 6 1; 4, 5 1; 1, 1 1)
=
=
(8, 2; 13, 6; 3, 5; 2, 1)
= max(|8, 2| ; |13, 6| ; |3, 5| ; |2, 1|) = 13, 6.
6


x
=
(1; 1; 1; 1)
= max(|1| ; |1| ; |1| ; |1|) = 1.
Atunci

A1

25

41

=
10

13, 6
= 13, 6
1
41

10

68 17 10

17 5 3

10 3 2

A
= max(|10|+|7|+|8|+|7| , |7|+|5|+|6|+|5| , |8|+|6|+|10|+|9| , |7|+|5|+|9|+|10|) =
= max(32, 23, 33, 31) = 33
 1 
A 

= max(|25| + |41| + |10| + |6| , |41| + |68| + |17| + |10| ,


, |10| + |17| + |5| + |3| , |6| + |10| + |3| + |2|) =
= max(82, 136, 35, 21) = 136.

Rezult
a c
a

Avem



cond(A) :=
A
A1 = 33 136 = 4488

b
=
b + b b
=
(32, 1 32; 22, 9 23; 33, 1 33; 30, 9 31)
=
=
(0, 1; 0, 1; 0, 1; 0, 1)
= max(|0, 1| ; |0, 1| ; |0, 1| ; |0, 1|) = 0, 1.

b
=
(32; 23; 33; 31)
= max(|32| ; |23| ; |33| ; |31|) = 33..
Atunci

0, 1
1
=
=

33
330
7

si
cond(A)
Deci

= 4488
= 13, 6

330

= cond(A)

Metode directe
Metoda lui Gauss (cu pivotare partiala)
Exemplul -1.10 Fie sistemul de ecuatii liniare

x + 21 y + 31 z = 1

1
x
2

+ 31 y + 14 z = 2

1
x
3

+ 41 y + 15 z = 3

Sa se calculeze determinantul matricei sistemului si sa se rezolve sistemul cu metoda


lui Gauss.
am cu (aij )1i,j3 matricea sistemului. Initializ
am det = 1. La etapa
Solutie Not
n = 1 c
aut
am cel mai mare element n modul de pe coloana n a matricei sistemului.
Acesta este max = |a11 | = 1 si se afla pa linia 1. Deci s = 1 si piv = a11 = 1. Calculam
det = det piv, deci det = 1. Cum s = n se trece la pasul mpartirii la pivot. Cum
pivotul este egal cu 1, prin mp
artire la pivot linia n r
amne nemodificat
a. Elimin
am
x din liniile 2 si 3 ca n algoritm. Obtinem urmatorul sistem de ecuatii:

x + 12 y + 13 z = 1

1
y
12

1
z
12

3
2

1
y
12

4
z
45

8
3

La etapa n = 2 c
aut
am cel mai mare element n modul de pe coloana n a matricei
sistemului (de la elementul a22 n jos). Acesta este max = |a22 | = 1/12 si se afla pa
8

linia 2. Deci s = 2 si piv = a22 = 1/12. Calcul


am det = det piv, deci det = 1/12. Cum
s = n se trece la pasul mp
artirii la pivot. Ecuatia 2 devine y + z = 18 . Elimin
am
y din linia 3 ca n algoritm. Obtinem urmatorul sistem de ecuatii:

x + 21 y + 13 z = 1

y + z = 18

1
z = 76
180

Calculam determinantul matricei sistemului det = det a33 =

1
12

1
180

1
2160

rezolvam sistemul anterior. Obtinem z = 210, y = 192, x = 27.

Metoda lui Gauss-Jordan de calcul a inversei unei matrice


Exemplul -1.11 Folosind metoda Gauss-Jordan

1 12 13

A = 12 13 14

1
3

Solutie Formam ansamblul matriceal

1 12 13

1 1 1
2 3 4

1
3

1
4

1
5

Cu transformarile din algoritm obtinem:

1 21 13

1
1
0 12
12

1
4
0 12
45

1
2

1
1
12

1
4

1
5

sa se calculeze inversa matricei



 1 0 0


 0 1 0


 0 0 1


 1 0 0


 1

 2 1 0


 1
 0 1
3



 1 0 0


1  6 12 0
 1
4 
3 0 1
45
1
3

si


0 0
 1


0 1 1  6 12 0


 1
1

1 1
0 0 180
6



1 12 13  1
0
0

0 1 1  6 12
0




0 0 1
30 180 180



1 21 0  9
60
60

0 1 0  36 192 180



0 0 1  30 180 180



1 0 0  9
36
30

0 1 0  36 192 180



0 0 1  30 180 180

Deci

1
2

1
3

36

30

A1 = 36 192 180

30 180 180

Rezolvarea unui sistem de ecuatii liniare Ax = b este echivalenta, dupa ce s-a


calculat inversa matricei A, cu egalitatea x = A1 b.

Factorizarea LU
Exemplul -1.12 S
a se factorizeze sub forma LU matricea

4 2 0
2

1 1 2

A=

4
5 2 9

0
1
3
4
10

Solutie Se verific
a mai nti c
a determinantii de colt ai matricei A sunt nenuli. Cu
formulele din curs se obtine:
l11 = 2, l21 = 1, l31 = 4, l41 = 0
u11 = 1, u12 = 2, u13 = 1, u14 = 0
l22 = 1, l32 = 3, l42 = 1
u22 = 1, u23 = 1, u24 = 3
l33 = 5, l43 = 2
u33 = 1, u34 = 0
l44 = 1
u44 = 1
Deci

0 0
2

1 1 0

L=
4 3 5

0
1 2

1 2 1 0

0 1 1 3

U =

0 0 1 0

0 0 0 1

,
0

Metoda radacinii patrate


Exemplul -1.13 Folosind metoda radacinii patrate, sa se rezolve sistemul de ecuatii
liniare Ax = b cu

A = 2 10 4

2 4 6

, b = 16

12

11

Solutie Se verific
a imediat ca matricea A este simetric
a. Deoarece


 4 2
1 = |4| > 0, 2 = 
 2 10




 4 2 2



 = 36 > 0, 3 =  2 10 4




 2 4 6






 = 144 > 0




rezulta ca matricea A este pozitiv definita. Cu formulele din curs se obtine


l11 = 2, l21 = 1, l31 = 1
l22 = 3, l32 = 1
l33 = 2
Rezulta ca
y1 = 4, y2 = 4, y3 = 2
si
x3 = 1, x2 = 1, x3 = 1.

Metode iterative de rezolvare a sistemelor de ecuatii liniare


Metoda lui Jacobi
Exemplul -1.14 S
a se arate ca se poate aplica metoda lui Jacobi (relativa la normele
1 si ) pentru sistemul de ecuatii liniare Ax = b cu

0, 1
0, 2
0, 3
0, 9

0, 2 0, 8

0,
1
0,
4

A=
;
b
=

0, 1 0, 3 0, 7 0, 1

0, 3 0, 2 0, 1 0, 9

12

3, 6

.
2, 4

1, 5

0

0

(0)
Lund x = sa se determine num
arul de iteratii necesar pentru a aproxima
0


0
solutia sistemului cu o eroare mai mic
a de 1010 .
Solutie: Avem

0, 1 0, 1 0, 2 0, 3

0, 2

0,
2
0,
1
0,
4

B =I A=

0, 1 0, 3
0, 3
0, 1

0, 3
0, 2
0, 1
0, 1
Atunci

B
1 = max

1j4

4

i=1

|bij | = max(|0, 1| +|0, 2| +|0, 1| +|0, 3| , |0, 1| +|0, 2| +|0, 3| +|0, 2| ,

|0, 2|+|0, 1|+|0, 3|+|0, 1| , |0, 3|+|0, 4|+|0, 1|+|0, 1|) = max(0, 7; 0, 8; 0, 7; 0, 9) = 0, 9 < 1.
si

B
= max

1i4

4

j=1

|bij | = max(|0, 1|+|0, 1|+|0, 2|+|0, 3| , |0, 2|+|0, 2|+|0, 1|+|0, 4| ,

|0, 1|+|0, 3|+|0, 3|+|0, 1| , |0, 3|+|0, 2|+|0, 1|+|0, 1|) = max(0, 7; 0, 9; 0, 8; 0, 7) = 0, 9 < 1.
Deci metoda lui Jacobi se aplic
a. Din formula de evaluare a erorii avem:

x(n) x
p

qn

x(1) x(0)
p , n N
1q

unde p = 1 sau p = , q = 0, 9, x(1) = Bx(0) + b = b. Deci, pentru a aproxima x cu


x(n) cu eroarea = 1010 este suficient ca

qn

x(1)
1q

x(0)
p < . Avem

x(1) x(0)
1 =
b
1 = |3, 6| + |2| + |2, 4| + |1, 5| = 9, 5
13

si

x(1) x(0)
=
b
= max(|3, 6| , |2| , |2, 4| , |1, 5|) = 3, 6
Atunci

qn
0, 9n

x(1) x(0)
1 <
9, 5 < 0, 9n <
n = log0,9
+1
1q
1 0, 9
95
95
si

0, 9n


qn

x(1) x(0)
<
3, 6 < 0, 9n <
n = log0,9
+1
1q
1 0, 9
36
36

Metoda Gauss-Seidel
Exemplul -1.15 Fie sistemul de ecuatii liniare

x + 1x + 1x = 1

1 2 2 3 3

1
x
5 1

1
x
10 1

+ x2 + 16 x3 = 2
+

1
x
20 2

+ x3 = 3

Sa se arate ca se aplic
a metoda Gauss-Seidel.
Solutie Not
am cu A matricea ceoficientilor sistemului. Avem

1 12 13

A = 15 1 61

1
1
1
10
20
Atunci

si

12

13

1
B = I A = 5
0 6

1
1
10 20 0
   
 1  1 5
q1 = |b11 | + |b12 | + |b13 | =   +   =
2
3
6
14

Deci

 
 
 1 5  1 1
q2 = |b21 | q1 + |b22| + |b23| =   +   =
5 6
6
3




 1 5  1 1
1
q3 = |b31| q1 + |b32 | q2 + |b33| =   +   =
10 6
20 3
10
q = max(q1, q2, q3 ) = max

5 1 1
, ,
6 3 10

5
<1
6

Rezult
a c
a metoda Gauss-Seidel se aplic
a.

Metoda relaxarii simultane


Exemplul -1.16 Fie sistemul de ecuatii liniare:

5x + 3x2 + 2x3 = 1

1
3x1 + 6x2 + 3x3 = 2

2x1 + 3x2 + 5x3 = 3

S
a se arate c
a se poate aplica metoda relax
arii simultane. S
a se determine parametrul
optim de relaxare. Lund x(0) = (0, 0, 0) sa se evalueze eroarea x x(n) .
Solutie: Notam cu A matricea sistemului. Avem

5 3 2

A = 3 6 3 = At transpusa matricei A.

2 3 5
Deci A simetrica. Deoarece


 5 3
1 := |5| > 0, 2 := 
 3 6




 5 3 2



 > 0, 3 :=  3 6 3




 2 3 5






 > 0,




cu teorema lui Sylvester rezult


a ca matricea A este si pozitiv definit
a. n concluzie, se
poate aplica metoda relaxarii simultane.
15

Fie D = diag(A). Atunci

3/5 2/5

D A = 1/2 1 1/2

2/5 3/5 1
1

6
si det(D1A I) = 0 (1 )3 19
(1 ) + 25
= 0. Dac
a not
am 1 = t, atunci
25

ecuatia 25t3 19t + 6 = 0 are radacinile t1 = 1, t2 = 2/5, t3 = 3/5, de unde rezulta


ca valorile proprii ale matricei D1 A sunt 1 = 2 > 2 = 3/5 > 3 = 2/5. Parametrul
optim de relaxare este
=

2
5
=
1 + 3
6

q=

2
1 3
= .
1 + 3
3

caruia i corespunde

Avem x(1) = C x(0) + c = c = D1 b = 5/6 (1/5; 2/6; 3/5)t unde b = (1; 2; 3)t este
vectorul termenilor liberi din sistem. Atunci

x(1)
2D

(1)

= Dx , x

(1)

25
=
36

1 2 9
+ +
5 3 5

si

(n)

qn
x
D

x(1) x(0)
D = 5
1q

2 25

3 9

 n+ 12
2
.
3

Metoda lui Ritz

1 2 3 4

2 5 1 10

Exemplul -1.17 Fie A =


3 1 35 5

4 10 5 30
1
culeze A .

16

. Folosind metoda lui Ritz sa se cal

Se verific
a mai nti c
a matricea A este simetric
a si pozitiv definita. Lu
am w0 =
(1, 0, 0, 0) . Atunci w0Aw0 = 1 si

1 0 0

0 0 0

C1 =
0 0 0

0 0 0

0
0 2 3 4

0 1

0
0
0

, D1 =
.

0
1
0
0 0

0
0 0
0
1

Luam v1 = (0, 1, 0, 0) . Rezulta ca w1 = (2, 1, 0, 0) si w1 Aw1 = 1, de unde

0 0 13 0
5 2 0 0

0 0 5 2
2 1 0 0

C2 =
.
, D2 =

0 0 1

0
0
0
0
0

0 0 0
1
0
0 0 0
Luam v2 = (0, 0, 1, 0) . Rezulta ca w2 = (13, 5, 1, 0) si w2Aw2

0 0 0
174 67 13 0

0 0 0
67 26
5 0

C3 =
, D3 =
0 0 0
13 5
1 0

0 0 0
0
0
0 0
Luam v3 = (0, 0, 0, 1) . Rezult
a c
a w3 = (39, 17, 3, 1) si

1695 730 130 39

730 315
56
17

C4 =
, D4 =

130 56
10
3

39
17
3
1

Pseudoinversa unei matrice

17

= 1, de unde

39

17

.
3

w3 Aw3 = 1, de unde

0 0 0 0

0 0 0 0

.
0 0 0 0

0 0 0 0

Exemplul -1.18 Fie

1 0 1

0 1 0

T =
cu rang(T ) = 2 si H0 = 0.
1 1 1

1 2 1

y1

1
1

Lu
am y1 = T = 0 (avem y1 H0T y1 = y1 = 0. Atunci w1 =
0



1
0

2

0

H0 T y1 = y1 si T w1 = . Rezulta ca
T w1
2 = 12, iar w1 (T w1 ) =
2


2

2 0 2
2

0 0 0
0 . Deci

2 0 2 2

w1(T w1)

H1 = H0 +
2 =

T w1

0
0

1

Luam y2 = T = 1
0



0
0

1/6

1/6

1/6

1/6 0 1/6 1/6

(avem
y

H
T
y
=

2
1
2

18

1/2
1
1/2

= 0. Atunci

w2 = y2 H1T y2

1/2 1/2 0

1
1
0

1/2 1/2 0

2
si T w2 =
. Rezulta ca
T w2
= 3, iar w2(T w2 ) =
0

1/2

1 . Deci

1/2

1/3

w2 (T w2 )

H2 = H1 +
2 = 1/3

T w2

1/3
n concluzie
T+
.

1/6
1/3
1/6

1/6

0
1/3

1/6 0

1/3 1/6 1/6


0

= H2 = 1/3 1/3
0
1/3

1/3 1/6 1/6 0

Exemplul -1.19 Fie

1 0 1

0 1 0

T =
cu dim R(T ) = 2
1 1 1

1 2 1

Lund e1 = (1; 0; 1) , e2 = (0; 1; 0) (baza n R(T )) obtinem f1 = (2; 0; 2; 2) , f2 =


(0; 1; 1; 2) . Atunci
1
1
x1 = (1; 0; 1) , y1 = (1; 0; 1; 1)
2 3
3
n continuare
1
e2 = e2 f2 , y1  x1 = (1; 2; 1) si f2 = T e2 = (1; 1; 0; 1)
2
19

Atunci
1
1
x2 = (1; 2; 1) , y2 = (1; 1; 0; 1)
2 3
3
Rezulta ca
+

T =

x1 y1

x2y2

= 2
6
2

1
2
1

0 2

1 0

Exemplul -1.20 Fie

1 0 1

0 1 0

T =
cu rang(T ) = 2 si H0 = T
1 1 1

1 2 1

5
1


3
0



Lund a1 = 0 , b1 = obtinem v0 := (I T H0) T a1 =
,
8
0


0
11
0

1
5/48

w0 = H0b1 = 0 , u0 :=
(I H0 T )w0 = 1/8 ,

v0 , T w0

1
5/48
1

23/48

5/16 1/6 7/48

H1 := H0 + u0 v0 = 5/8
5/8
0
5/8

23/48 5/16 1/6 7/48



7/8
0
0


7/8
1



Lund a2 = 1 , b2 = obtinem v1 := (I T H1 ) T a2 =
0
0


0
7/8
0
20

, w1 =

H1 b2 =

5/16

1/6

(I H1 T )w1 = 1/3 , deci


5/8 , u1 :=

v1 , T w1

5/16
1/6

1/3 1/6 1/6


0

T + = H2 := H1 + u1 v1 = 1/3 1/3
0
1/3 .

1/3 1/6 1/6 0

Metode pentru aproximarea valorilor proprii ale


unei matrice
Metode folosind polinomul caracteristic
Metoda Krylov
Exemplul -1.21 Determinati polinomul caracteristic pentru matricea

5 4 3 1

4
2
9

A=
,
2

5
1
5

7
1
2 1
folosind metoda Krylov.

Alegem pentru aplicarea metodei

y (1) = Ay (0)

16

21

=
5

11

1

2

am
Krylov vectorul y(0) = si calcul
3


4

209

,
, y(2) = Ay(1) =

197

154
21

y (3)

1621

164

= Ay (2)
,
456

393

y(4) = Ay (3)

9210

4902

=
.
5571

10992

Coefientii polinomului caracteristic se obtin rezolvd sistemul:

8 16 1 p1 9210
1621


164 209 21 2 p2 4902

=
456 197 5 3 p 5571

p4
10992
393 154
11 4

45

Folosind o metoda de rezolvare a sistemelor liniare , obtinem p =


si polino 369

885
mul caracteristic este:
pA () = 4 + 93 452 + 369 + 885 . 

Metoda Leverrier
Exemplul -1.22 Determinati, folosind metoda Leverrier, polinomul caracteristic si
matricea A1 , daca exista, pentru matricea

0 3
12
11

9 5

2
5

A=
,
2 4 15 11

2
6 7
10
Aplicnd metoda Leverrier pentru matriceaA si m = 4, obtinem:
s1 = 31 ,

p1 = 31 ,
22

- pentru k = 2:

84 162
285
139

40

47
12
105

2
A2 = A =
,
66 106

288
271

26
58 169
231

- pentru k = 3:

s2 = 705 ,

p2 = 128 ,

1938 4674
6720
1019

1049 913
1129
1427

A3 = A3 =
,
7714 2248

5807
5616

684
1772 3958
4147
s3 = 10060 ,

- pentru k = 4:

p3 = 2609 ,

49326 116331
140532
2141

3918 8513
28245
43842

A4 = A4 =
,

39468 45684
116779
110709

23094
31854 82803
85660
s4 = 191785 ,

p4 = 12761 ,

si polinomul caracteristic este:

pA () = 4 313 + 1282 + 2609 12761 .


Cum p4 = 0, rezult
a c
a:
A1 = p14 (A3 + p1 A2 + p2A + p3 I4)

0.0570 0.0522 0.0028 0.0454

0.0753 0.0314
0.0794
0.1934

=
.
0.0060

0.0412
0.1103
0.1079

0.0296
0.0581
0.0302
0.0686
23

Exemplul -1.23 Calculati coeficientii polinomului caracteristic si matricea A1 , dac


a
exista, pentru matricea

1 3
2
11

9 5 12

A=
,
2 4

5
11

2 16 7
10
folosind algoritmul Fadeev.
Aplicnd algoritmul Fadeev obtinem:

A1 = A ,

p1 = tr(A1 ) = 21 ,

1 3
2
10

9 26
12
5

B1 = A1 + p1 I4 =
,

2 4 16 11

2
16 7 11

- pentru k = 2

29
13
38
121

169
153 260 230

A2 = AB1 =
,

4
90
57
50

158 226
228
51

1
p2 = tr(A
= 13 ,
2)

29
13
38
134

169
140 260 230

B2 = A2 + p2 I4 =
,

4
90
70
50

158 226
228
38
24

- pentru k = 3

277
549
114
1633

381 3171
1483
1598

A3 = AB2 =

814
1534 1792
828

828
668 1364 3574

1
p3 = tr(A
= 3390 ,
3)

549
114
1757 277

381 219
1483 1598

B3 = A3 + p3 I4 =
814 1534
1598
828

828 668 1364 184

- pentru k = 4

0
0
0
18160

0 18160
0
0

A4 = AB3 =

0
0 18160
0

0
0
0 18160

1
p4 = tr(A
= 18160 ,
4)

0 0 0

0 0 0

B4 = A4 + p4I4 =
0 0 0

0 0 0

Polinomul caracteristic este:


pA () = 4 213 132 + 3390 18160 .
Cum p4 = 0, rezult
a c
a:

25

.
0

A1

0.0302
0.0063
0.0968 0.0153

0.0210 0.0121
0.0817
0.0880
1

= B3 =
0.0448 0.0845
p4
0.0880
0.0456

0.0456 0.0368 0.0751 0.0101

Metoda rotatiilor

. 

Exemplul -1.24 Fie matricea

17

A = 2
8

3 3 2 3

3 3

2 3
11

Folosind metoda rotatiilor, s


a se determine valorile proprii ale matricei A.
Se verifica imediat c
a matricea A este simetric
a. Se aleg p < q astfel nct
|apq | = max{aij |; i < j {1, 2, 3}.
Atunci p = 1, q = 3. Se calculeaza
=
Se ia

si se calculeaz
a matricea

1
2 apq

arctan
= .
2
app aqq
6

T =

cos 0 sin
0

sin 0

cos

20 0 0

B = T t AT = 0

0
26

8 4

4 8

Se aleg p < q astfel nct


|bpq | = max{bij |; i < j {1, 2, 3}.
Atunci p = 2, q = 3. Se calculeaz
a

deoarece bpp = bqq .


4

=
Se ia

T = 0 cos sin

0 sin cos

si se calculeaz
a matricea

20

B = T AT == 0

0
t

12 0

0 4

Rezult
a c
a valorile proprii ale matricei A sunt 1 = 20, 2 = 12, 3 = 4. 

Ecuatii neliniare n Rm
Principiul contractiei
Exemplul -1.25 Fie sistemul de ecuatii

x = (80 + x3 x2 3yz)/100

y = (60 y 3 z 2 + 4xz)/86

z = (40 + z 3 + y 2 5xy)/72

(3)

Folosind principiul contractiei n raport cu norma



, s
a se arate ca sistemul
(3) are solutie unic
a v n V := [0, 2]3 . Pentru o eroare data si pentru iterata initiala
x(0) := (1, 1, 1) sa se calculeze iterata x(n) (din principiul contractiei) pentru care
x(n)
v
.
27

Fie r = 1 si a = (1, 1, 1). Atunci multimea V = {x Rm |


x a
r}.
Fie functia F = (f, g, h) : V R

cu f(x, y, z) := (80 + x3 x2 3yz)/100,

g(x, y, z) := (60y3 z 2 +4xz)/86 si h(x, y, z) := (40+z 3 +y 2 5xy)/72, (x, y, z) V .


Sistemul de ecuatii (3) este echivalent cu F (x, y, z) = (x, y, z).
Avem

F (x, y, z) =

(3x2 2x)/100
4z/86
5y/72

3z/100

3y/100

3y /86
(2z + 4x)/86 ,

2
(2y 5x)/72
3z /72
2

deci
F  (x, y, z)
= max((|3x2 2x| + | 3z| + | 3y|)/100, (|4z| + | 3y 2 | +
| 2z + 4x|)/86, (| 5y| + |2y 5x| + |3z 2 |)/72) max(28/100, 32/86, 36/72) =
= 1/2 (am folosit 0 x, y, z 2). Putem lua q = 1/2. Pe de alta parte
F (a) a
=
max(28/100, 24/86, 35/72) = 35/72 < (1 q)r = 1/2. Deci F este 1/2-contractie a
multimii V n raport cu norma

. Din principiul contractiei rezulta ca ecuatia
F (x, y, z) = (x, y, z) are solutie unica n V .
Pentru x(0) = (1, 1, 1) se calculeaz
a x(n) cu formula de recurenta x(n) = F (x(n1) ),
n N . Se opreste procesul iterativ atunci cnd q/(1 q)
x(n) x(n1)
< .

Metoda Gauss-Seidel neliniara

Exemplul -1.26 Fie sistemul de ecuatii

x = (432 + x4 + y 4 2z4 + y 2 z2 )/234

y = (324 x4 + 2y 4 3z 4 + 3x2 z 2 )/432

z = (234 + 2x4 3y4 + 4z4 x2y 2 + 3x + y)/324

(4)

Folosind metoda Gauss-Seidel neliniar


a, s
a se arate c
a sistemul (4) are solutie unic
a
v n V := [2, 2] [1, 1] [0, 1]. Pentru o eroare data si pentru iterata initiala
x(0) := (0, 0, 1/2) sa se calculeze iterata x(n) pentru care
x(n) v
.
Fie r1 = 2, r2 = 1 si r3 = 1/2, a1 = a2 = 0 si a3 = 1/2. Atunci multimea
V = {(x, y, z) R3 | |x a1 | r1 , |y a2| r2 , |z a3 | r3 }. Fie functia
28

F = (f, g, h) : V R

cu f (x, y, z) := (432 + x4 + y4 2z 4 + y 2 z 2)/234, g(x, y, z) :=

(324x4 +2y 4 3z 4 +3x2 z 2 )/432 si h(x, y, z) := (234+2x4 3y4 +4z4 x2 y2 +3x+y)/324,


(x, y, z) V . Sistemul de ecuatii (4) este echivalent cu F (x, y, z) = (x, y, z).
Avem F  (x, y, z) =

4x /234
(4y + 2yz )/234
(8z + 2y z)/234

(4x3 + 6xz2 )/432


8y 3/432
(12z 3 + 6x2z)/432

(8x3 2xy 2 + 3)/324 (12y 3 2x2y + 1)/324


16z 3/324

deci
F  (x, y, z)
= max((|4x3 | + |4y3 + 2yz 2 | + | 8z 3 + 2y 2 z|)/234, (| 4x3 + 6xz 2 | +
|8y 3 | + | 12z3 + 6x2z|)/432, (|8x3 2xy2 + 3| + | 12y3 2x2 y + 1| + |16z 3 |)/324)
max(48/234, 88/432, 108/234) = 1/3 (am folosit 2 x 2, 1 y 1, 0 z 1).
Putem lua q = 1/3. Pe de alta parte |f(x, y, z) a1 | (|432| + |x4 | + |y 4| + |2z 4| +
|y2 z 2 |)/234 452/234 < 2, |g(x, y, z)a2 | (|324|+|x4|+|2y 4 |+|3z 4 |+|3x2z 2 |)/432
357/432 < 1 si |h(x, y, z) a3 | (|234| + |2x4| + |3y4 | +|4z4 | +|x2 y2 | +|3x| +|y|)/324
122/324 < 1/2, (x, y, z) V . Deci F (V ) V si F este 1/3-contractie a multimii V n
raport cu norma

. Din principiul contractiei rezulta ca ecuatia F (x, y, z) = (x, y, z)


ar solutie unic
a n V .
(n)
(n)
Pentru x(0) = (0, 0, 1/2) se calculeaza x(n) = (x(n)
ta
1 , x2 , x3 ) cu formula de recuren
(n1)
(n)
(n1)
x(n)
= f (x(n1)), x(n)
= g(x(n)
, x(n1)
), x(n)
= h(x(n)
) n N . Se
1
2
1 , x2
3
3
1 , x2 , x3

opreste procesul iterativ atunci cnd q/(1 q)


x(n) x(n1)
< .

Metoda lui Newton

Exemplul -1.27 Fie sistemul de ecuatii

x3 + 3xy 2 + 3xz 2 183x + 2 = 0

y 3 + +3x2y + 3yz 2 193y + 1 = 0

3
z + 3x2 z + 3y 2z 188(z 1) 1 = 0

(5)

Folosind metoda Newton relativa la norma



, sa se arate ca sistemul (5) are solutie
29

unic
a v n V := [1, 1]2 [0, 2]. Pentru o eroare dat
a si pentru iterata initial
a
x(0) := (0, 0, 1) sa se calculeze iterata x(n), pentru care
x(n) v
.
Fie r = 1 si a = (0, 0, 1). Atunci multimea V este Br (a) n raport cu norma


. Fie functia F = (f, g, h) : V R3 cu f (x, y, z) := x3 + 3xy 2 + 3xz 2 183x + 2,
g(x, y, z) := y 3 ++3x2y+3yz 2 193y+1 si h(x, y, z) := z3 +3x2 z+3y 2 z188(z1)1 =
0, (x, y, z) V . Sistemul de ecuatii (5) este echivalent cu F (x, y, z) = 0.
Avem F  (x, y, z) =

3x2 + 3y 2 + 3z 2 183
6xy
6xz

6xy
3x2 + 3y 2 + 3z 2 193
6yz

6xz
6yz
3x2 + 3y2 + 3z 2 188

6x 6y 6z 6y 6x

6z

6x

F  (x, y, z) = 6y 6x 0 6x 6y 6z 0 6z 6x

6z 0 6x 0 6z 6y 6x 6y 6z

deci
F  (x, y, z)
max(|18x| + |12y| + |12z|, |12x| + |18y| + |12z|, |12x| + |12y| +
|18z|) max(54, 54, 60) = 60 (am folosit 1 x, y 1, 0 z 2). Putem lua

180
0
0

M = 60. Avem F  (a) = 0


190
0 , deci F  (a) inversabila, (F  (a))1 =

0
0
185

1/180
0
0

si
(F  (a))1
= max(1/180, 1/190, 1/185) = 1/180.
0
1/190
0

0
0
1/185
Luam = 1/180. Cum M r = 60/180 < 1 si /(1 M R) = 1/120, putem
lua = 120. Avem F (a) = (2, 1, 0)t si (F  (a))1 F (a) = (1/90, 1/190, 0)t , deci

(F  (a))1 F (a)
= 1/90. Lua m = 1/90. Conditia (1 q)r implica q 89/90.
Din
F (x, y, z)
max(|x3| + |3xy2 | + |3xz 2| + |183x| + 2, |y 3 | + |3x2 y| + |3yz 2 | +
|193y| + 1, |z3 | + |3x2 z| + |3y2 z| + |188(z 1)| + 1) max(201, 210, 209) = 210 rezulta
30

c
a (M/2 )
F (x, y, z)
qq 210/240 = 7/8. Din M r/ q rezult
a q 1/2.
Deci putem lua q = 7/8 si atunci ecuatia F (x, y, z) = 0 are o solutie unic
a n V .
Pentru x(0) = (0, 0, 1) se calculeaza x(n) cu formula de recurenta (5) (folosind la
fiecare pas o procedura de inversare a matricei (F  (x(n) ))1 ). Se opreste calculul iterativ
n

atunci cnd (2)/M q 2 4 (7/8)2 .

Metoda lui Newton simplificata

Exemplul -1.28 Fie sistemul de ecuatii

x2 + y 2 + z 2 + x + y + z 853/144 = 0

3x2 4y2 + z 2 + x y 3z + 1309/432 = 0

(6)

5x2 + 2y 2 3z2 + 2x 4y 6z + 37/9 = 0

Folosind metoda Newton simplificata relativa la norma



, sa se arate c
a sistemul
(6) are solutie unic
a v n V := [0, 8; 1, 2]3 . Pentru o eroare dat
a si pentru iterata
initiala x(0) := (1, 1, 1), sa se calculeze iterata x(n) pentru care
x(n) v
.
Fie r := 0, 2 = 1/5 si a := (1, 1, 1). Atunci multimea V este Br (a) n raport cu
norma

. Fie functia F = (f, g, h) : V R3 cu f(x, y, z) := x2 + y2 + z 2 + x +
y + z 853/144, g(x, y, z) := 3x2 4y2 + z 2 + x y 3z + 1309/432 si h(x, y, z) :=
5x2 + 2y 2 3z 2 + 2x 4y 6z + 37/9, (x, y, z) V . Sistemul de ecuatii (6) este
echivalent cu F (x, y, z) = 0.
Avem

2x + 1

F (x, y, z) = 6x + 1

10x + 2

2 0 0

F  (x, y, z) = 6 0 0

10 0 0


31

2y + 1

2z + 1

8y 1
4y 4
0

0 8 0
0

2z 3 ,

6z 6

0 0 2

0 0 2 ,

0 0 6

deci
F  (x, y, z)
max(|2|+|2|+|2|, |6|+|8|+|2|, |10|+|4|+|6|) = 20, (x, y, z)

3 9
3


V . Putem lua M = 20. Avem F (a) = 7 9 1 , cu det(F  (a)) = 72, deci

12 0 12

9 3
2

F  (a) inversabila, (F  (a))1 =


6 6 2 si
(F  (a))1
= max(14/72, 14/72, 16/72) =
72

9 3 4
2/9. Lu
a m = 2/9. Avem F (a) = (11/144, 13/432, 1/9)t si (F  (a))1 F (a) =
(1/72, 1/144, 1/216)t , deci
(F  (a))1 F (a)
= 1/72. Luam = 1/72. Conditia
(1 q)r implica q 67/72. Din M r q rezulta q 8/9. Deci putem lua
q = 8/9 si atunci ecuatia F (x, y, z) = 0 are o solutie unic
a n V .
Pentru x(0) = (1, 1, 1) se calculeaza x(n) cu formula de recurenta (6). Se opreste
calculul iterativ atunci cnd q/(1 q)
x(n) x(n1)
.

Interpolare polinomiala
Formula lui Lagrange
Exemplul -1.29 Utiliznd formula lui Lagrange de reprezentare s
a se determine polinomul de interpolare de grad 2 ce verific
a conditiile:
P (0) = 2, P (1) = 1, P (4) = 4.
Din curs rezult
a c
a:
P (x) = P (0)L1 (x) + P (1)L2(x) + P (4)L3(x).
Avem:
L1(x) =

(x 1)(x 4)
x2 5x + 4
=
,
(0 1)(0 4)
4

L2 (x) =

x(x 4)
x2 4x
=
,
(1 0)(1 4)
3
32

x(x 1)
x2 x
L3 (x) =
=
.
(4 0)(4 1)
12

Atunci:
P (x) = 2

x2 5x + 4
x2 4x
x2 x
1
3
+1
+4
= x2 x + 2.
4
3
12
2
2

Algoritmul lui Aitken

Exemplul -1.30 Fie functia f : [0, 12] R cu f(x) = 6 2x + 1 2x, x [0, 12].
Sa se determine polinomul de interpolare Lagrange P (f; 0, 4, 12; x) utiliznd algoritmul
Aitken.
Nodurile sunt x1 = 0, x2 = 4, x3 = 12. Atunci P11 (x) = f (0) = 6, P12 (x) = f (4) =
10, P13(x) = f(12) = 6. Rezulta ca
P22 (x) =

10x 6(x 4)
= x + 6,
4

P23 (x) =

6x 6(x 12)
=6
12

si astfel
x2 3x
+6.
P (f ; 0, 4, 12; x) = P33 (x) = +
8
2

Algoritmul lui Neville

Exemplul -1.31 Fie functia f : [0, 12] R cu f(x) = 6 2x + 1 2x, x [0, 12].
Sa se determine polinomul de interpolare Lagrange P (f; 0, 4, 12; x) utiliznd algoritmul
Neville.
Nodurile sunt x1 = 0, x2 = 4, x3 = 12. Atunci P11 (x) = f (0) = 6, P12 (x) = f (4) =
10, P13(x) = f(12) = 6. Rezult
a c
a
P22 (x) =

10x 6(x 4)
= x + 6,
4
33

P23 (x) =

x
6(x 4) 10(x 12)
= + 12
8
2

si astfel
x2 3x
P (f ; 0, 4, 12; x) = P33 (x) = +
+6
8
2

Formula lui Newton de reprezentare a polinomului de interpolare

Exemplul -1.32 Fie functia f : [0, 4] R cu f (x) = 6 2x + 1 2x, x [0, 4].


Utiliznd formula de reprezentare Newton sa se determine polinomul de interpolare
Hermite P (x) = P (f; 0, 0, 0, 4, 4; x). Se se evalueze eroarea |f(x) P (x)|.
Avem x1 = x2 = x3 = 0, x4 = x5 = 4. Din formula de reprezentare Newton avem:
P (f ; 0, 0, 0, 4, 4; x) = f(0) + f(0, 0)x + f (0, 0, 0)x2 +
+f(0, 0, 0, 4)x3 + f(0, 0, 0, 4, 4)x3 (x 4)
Vom calcula diferentele divizate cu formulele de recurenta date de (??). Calculele le
vom organiza ntr-un tabel de forma:
nod

d.d.

d.d.

d.d.

d.d.

d.d.

1n

2n

3n

4n

5n

x1

f(x1 ) f (x1 , x2) f(x1 , x2 , x3 ) f(x1, x2 , x3 , x4) f(x1 , . . . , x5 )

x2

f(x2 ) f (x2 , x3) f(x2 , x3 , x4 ) f(x2, x3 , x4 , x5)

x3

f(x3 ) f (x3 , x4) f(x3 , x4 , x5 )

x4

f(x4 ) f (x4 , x5)

x5

f(x5 )

(am notat cu "d.d.kn " diferente divizate asociate la k noduri).

Cum f (x) = 6 2x + 1 2x = 6(2x + 1)1/2 2x, rezulta ca f  (x) = 6(2x + 1)1/2


2 si f  (x) = 6(2x + 1)3/2 . Atunci f (0) = 6, f(4) = 10, f (0, 0) = f  (0) = 4,
f(0, 4) = (f (4) f(0))/(4 0) = 1, f(4, 4) = f  (4) = 0, f(0, 0, 0) = 12 f  (0) = 3,
34

f(0, 0, 4) = (f(0, 4) f(0, 0))/(4 0) = 3/4 etc.. Rezult


a urm
atorul tabel n cazul
datelor problemei:
nod 1n 2n

3n

4n

5n

9/16 7/64

3/4 2/16

1/4

10

10

Atunci (cu formula de reprezentare Newton) avem


P (f; 0, 0, 0, 4, 4; x) = 6 + 4x 3x2 +

9 3
7
x x3(x 4).
16
64

Din formula de evaluare a erorii rezulta ca


|f(x) P (f ; 0, 0, 0, 4, 4; x)|

M5 3
|x (x 4)2| x [0, 4],
5!

unde M5 = sup |f (5) (x)|. Avem f (3) (x) = 18(2x + 1)5/2, f (4) (x) = 90(2x + 1)7/2,
x[0,4]

(5)

(x) = 630(2x + 1)9/2. Cum f (6) (x) = 630 9(2x + 1)11/2 < 0, rezult
a c
a f (5) este

descrescatoare si cum f (5)(x) > 0 x [0, 4] rezulta ca M5 = f (5)(0) = 630. Atunci


|f(x) P (x)|

630 3
21
|x (x 4)2 | = x3(x 4)2 , x [0, 4]. 
120
4

Formula lui Newton de interpolare ascendenta


Exemplul -1.33 Sa
se determine, folosind formula de interpolare Newton ascendenta,
polinomul Lagrange atasat datelor: n = 3, x0 = 4, h = 2 (de unde x1 = 6, x2 = 8,
x3 = 10) si f : R R o functie continua cu f(x0) = 1, f(x1 ) = 3, f(x2) = 8,
f(x3 ) = 20 si s
a se estimeze valoarea functiei f n punctul x = 7.

35

Organiz
am calculul diferentelor nedivizate ascendente n tabelul urmator:
k xk f (xk ) 1h f (xk ) 2h f (xk ) 3h f (xk )
0

12

3 10

20

(De exemplu 1h f(x0 ) = h f (x0) = f(x1 )f (x0 ) = 31 = 2, 2h f(x0) = 1h h f (x0 ) =


h f(x1 ) h f (x0) = 1h f(x1) 1h f(x0 ) = 5 2 = 3, etc.) Atunci 0h f(x0) = 1,
1h f(x0 ) = 2, 2h f(x0) = 3, 3h f (x0 ) = 4.
x x0
x4
x4
Fie x R Avem q =
=
si atunci Cq0 = 1, Cq1 = q =
, Cq2 =
h
2
2
(x 4)(x 6)
q(q 1)(q 2)
(x 4)(x 6)(x 8)
q(q 1)
=
, Cq3 =
=
. Rezulta
2
8
6
48
c
a: P (f; x0 , x1, x2 , x3 ; x) =
3

i=0

3
4
Cqi ih f (x0 ) = 1 + (x 4) + (x 4)(x 6) + (x 4)(x 6)(x 8)
8
48

si deci
P (f ; x0 , x1, x2 , x3 ; 7) = 1 + 3 +

39
9 1
=
= 4.875 .
8 4
8

Formula lui Newton de interpolare descendenta


Exemplul -1.34 S
a se determine, folosind formula de interpolare Newton descendenta, polinomul Lagrange atasat datelor: n = 3, x0 = 10, h = 2 (de unde x1 = 8,
x2 = 6, x3 = 4) si f : R R o functie continua cu f(x0) = 20, f(x1 ) = 8,
f(x2) = 3, f(x3 ) = 1 si sa se estimeze valoarea functiei f n punctul x = 7.

36

Organiz
am calculul diferentelor nedivizate descendente n tabelul urm
ator:
k

xk f (xk ) 1h f(xk ) 2h f(xk ) 3h f(xk )

10

20

12

(De exemplu 1h f(x0 ) = h f (x0 ) = f(x0) f(x1 ) = 20 8 = 12, 2h f (x0 ) =


1h h f(x0 ) = h f (x0 ) h f (x1 ) = 1h f (x0 ) 1h f (x1 ) = 12 5 = 7, etc.) Atunci
0h f(x0 ) = 20, 1h f(x0 ) = 12, 2h f(x0) = 7, 3h f(x0 ) = 4.
x x0
x 10
si atunci
Fie x R. Avem q =
=
h
2
q(q 1)
(x 10)(x 8)
x 10
1
2
3
0
, Cq
=
=
, Cq
=
Cq
= 1, Cq
= q =
2
2
8
q(q 1)(q 2) (x 10)(x 8)(x 6)
=
. Rezult
a c
a:
6
48
3

i
P (f; x0 , x1, x2 , x3 ; x) =
(1)i Cq
ih f (x0 ) =
i=0

= 20 +

7
4
12
(x 10) + (x 10)(x 8) + (x 10)(x 8)(x 6)
2
8
48

si deci
P (f; x0, x1 , x2 , x3 ; 7) = 20 18 +

21 1
39
+ =
= 4.875 .
8
4
8

Formula de interpolare Gauss nainte


Exemplul -1.35 S
a se determine, folosind formula de interpolare Gauss nainte, polinomul Lagrange ata
sat datelor: n = 2, x0 = 6, h = 2 (de unde x2 = 2, x1 = 4,
x1 = 8, x2 = 10) si f : R R o functie continu
a cu f(x2 ) = 2, f (x1) = 1,
f(x0 ) = 3, f(x1 ) = 8, f(x2 ) = 20 si s
a se estimeze valoarea functiei f n punctul
x = 7.

37

Printr-un calcul elementar, se arat


a c
a, pentru orice i = 1, 2:
2i
2i1
f(x1/2 ) = 2i1
f(xi+1) si 2i
h f(x0 )) = h f (xi )).
h
h

Atunci: P (f; x2 , x1 , x0 , x1, x2 ; x) =


2

2i1
2i
f(x0) +
(Cq+i1
2i1
f (xi+1 ) + Cq+i1
2i
h f(xi )) =
h
i=1

3
4
3h f (x1 ) + Cq+1
4h f(x2 ).
= f(x0 ) + Cq1 1h f(x0 ) + Cq2 2h f (x1) + Cq+1

Organiz
am calculul diferentelor finite ascendente n tabelul urm
ator:
k

xk f(xk ) 1h f(xk ) 2h f(xk ) 3h f(xk ) 4h f(xk )

12

10

20

Avem: f(x0) = 3, 1h f(x0 ) = 5, 2h f (x1) = 3, 3h f(x1 ) = 4, 4h f(x2 ) = 0. Cum


x6
x6
q(q 1)
(x 6)(x 8)
3
q =
rezulta ca Cq1 = q =
, Cq2 =
=
, Cq+1
=
2
2
2
8
(q + 1)q(q 1) (x 4)(x 6)(x 8)
=
. Atunci:
6
48
P (f; x2 , x1, x0 , x1 , x2 ; x) =
= 3+5

x6
(x 6)(x 8)
(x 4)(x 6)(x 8)
+3
+4
2
8
48

si
f(7)  P (f; x2 , x1 , x0 , x1, x2 ; 7) = 3 +

5 3 1
39
=
= 4.875 .
2 8 4
8

Formula de interpolare Gauss napoi


38

Exemplul -1.36 S
a se determine, folosind formula de interpolare Gauss napoi, polinomul Lagrange atasat datelor: n = 2, x0 = 6, h = 2 (de unde x2 = 2, x1 = 4,
x1 = 8, x2 = 10) si f : R R o functie continua cu f(x2 ) = 2, f (x1) = 1,
f(x0 ) = 3, f(x1 ) = 8, f(x2 ) = 20 si sa
se estimeze valoarea functiei f n punctul
x = 7.
Printr-un calcul elementar, se arata ca, pentru orice i = 1, 2:
2i
2i1
f(x1/2 ) = 2i1
f(xi+1) si 2i
h f(x0 )) = h f (xi )).
h
h

Atunci: P (f; x2 , x1 , x0 , x1, x2 ; x) =


2

2i1
2i
f(x0 ) +
(Cq+i1
2i1
f (xi ) + Cq+i
2i
h f(xi )) =
h
i=1

2
3
4
= f(x0 ) + Cq1 1h f(x1 ) + Cq+1
2h f (x1 ) + Cq+1
3h f(x2 ) + Cq+2
4h f(x2 ).

Organizam calculul diferentelor finite ascendente n tabelul urmator:


k

xk f(xk ) 1h f(xk ) 2h f(xk ) 3h f(xk ) 4h f(xk )

12

10

20

Avem: f(x0 ) = 3, 1h f(x1) = 2, 2h f(x1 ) = 3, 3h f (x2) = 4, 4h f(x2 ) = 0. Cum


x6
x6
(q + 1)q
(x 4)(x 6)
2
3
, rezult
a c
a Cq1 = q =
, Cq+1
=
=
, Cq+1
=
q =
2
2
2
8
(q + 1)q(q 1) (x 4)(x 6)(x 8)
=
. Atunci:
6
48
P (f; x2 , x1, x0 , x1 , x2 ; x) =
39

= 3+2

(x 4)(x 6)
(x 4)(x 6)(x 8)
x6
+3
+4
2
8
48

si
f (7)  P (f; x2 , x1, x0 , x1 , x2 ; 7) = 3 + 1 +

9 1
39
=
= 4.875 . 
8 4
8

Constructia curbelor de regresie


1. Fie (x1 , y1 ), . . . , (xn , yn ) puncte distincte din plan (n 2).
Propozitia -1.1 Pentru a construi o dreapt
a de regresie, adica o dreapta y = ax+b
pentru care suma
S=

n

i=1

(yi (axi + b))2

sa fie minima (suma p


atratelor distantelor la n puncte fixe), coeficientii a si b se determina astfel:

n

yi n x i yi
i=1
i=1
a = i=1
 n 2
n


xi n x2i
n


xi

n


i=1

n


i=1

n


n


n

xi
xi yi
x2i
yi
i=1
i=1
i=1
i=1
b=
 n 2
n


xi n x2i
i=1

i=1

Exemplu Pentru n = 4, (x1 , y1 ) = (0, 1), (x2, y2 ) = (1, 3), (x3 , y3 ) = (3, 7),
(x4, y4 ) = (5, 11) se obtine a = 2, b = 1.

Propozitia -1.2 Pentru a construi un polinom de regresie de grad m , adica o


curb
a de ecuatie
y = Pm (x) := c1 + c2x + c3 x2 + + cm+1 xm
pentru care suma
Sm =

n

i=1

(yi Pm (xi ))2


40

s
a fie minim
a, coeficientii c1 , c2, . . . , cm+1 se determin
a ca solutia sistemului de ecuatii
liniare

n


xi

n


x2i

i=1
i=1

n
n


n x
2
x
x3i

i
i
i=1
i=1
i=1

n
n
n



2
3
x
x
x4i

i
i
i=1
i=1
i=1

...
...
...


n
n
n


xm
xm+1
xm+2
i
i
i
i=1

i=1

i=1

...

n


i=1

...
...

n


i=1
n

i=1

...
...

xm
i

xm+1
i
xm+2
i

...
n

x2m
i

i=1

c1

n


yi

i=1

x
y

i i
c2
i=1

2
=
c3
x
y
i

i
i=1

... ...

n
cm+1
xm
i yi
i=1

(Rezolvarea acestui sistem se poate face att cu metode directe ct si cu metode


iterative.
Exemplu Pentru n = 6, (x1 , y1 ) = (4.5, 0.7), (x2 , y2 ) = (3.2, 2.3), (x3 , y3 ) =
(1.4, 3.8), (x4 , y4 ) = (0.8, 0.5), (x5 , y5) = (2.5, 5.5), (x6, y6 ) = (4.1, 5.6), m = 3 se
obtine P3 (x) = 4.66863 + 0.489392x 0.0742387x2 + 0.00267659x3 .

Metode numerice pentru ecuatii diferentiale


Metode ntr-un pas (directe)
Metoda Euler explicita (progresiva)
Exemplul -1.37 Folosind metoda Euler, determinati solutia aproximativ
a a problemei
Cauchy:

n t = 2, lund h = 0.5.
Avem f(t, y) = y2

y  = y2 y 1 ,
t
4t2
y(1) = 0.75

t [1, 2]

y
1
2 , t0 = 1 si y0 = 0.75 . Se obtine N = 2 si yn+1 =
t 4t

41

yn + 0.5f(tn , yn ), pentru n = 0, 1 . Deci rezult


a:
t1 = 1.5 , y(t1 )  y1 = y0 + 0, 5f (t0 , y0) = 0.75 + 0.5f(1, 0.75) =
0.75 + 0.5(0.4375) = 0.5313 ,
t2 = 2 , y(t2 )  y2 = y1 + 0, 5f (t1 , y1) = 0.5313 + 0.5f(1.5, 0.5313) =
0.5313 + 0.5(0.1831) = 0.4397 .

Metoda Euler modificata (ameliorata)


Schema numerica pentru metoda Euler modificata este urmatoarea:

y0 = y(t0 ),


y
= y + hf t + 1 h, y + 1 hf (t , y ) , n = 0, N 1 .
n+1

Metoda Heun (sau Metoda Euler mbunatatita)


Schema numerica pentru metoda Heun este urmatoarea:

y0 = y(t0 ),
y
1
n+1 = yn + 2 h (f(tn , yn ) + f (tn + h, yn + hf (tn , yn ))) , n = 0, N 1 .

Metode Runge-Kutta

Exemplul -1.38 Se da problema Cauchy:

y  = y2 y 1 ,
t
4t2

y(1) = 0.75

t [1, 2.9]

Sa se determine valoarea aproximativ


a a solutiei n t = 2.9, folosind metoda si RK24 ,
pentru N = 2.
Pentru N = 2 avem h = 0.9500. Luam y0 = 0.75, t0 = 1. Pentru metoda RK24,
1
y
avem f(t, y) = y 2 2 . Se obtine:
t
4t
42

- pentru n = 1:
y0,1 = y0 = 1 ,

t0,1 = t0 = 1 ,

y0,2 = y0 = 1 + 0.95f (t0,1, y0,1)/2 = 0.8812 ,

t0,2 = t0 + 0.95/2 = 1.4750 ,

y0,3 = y0 = 1 + 0.95f (t0,2, y0,2)/2 = 1.0305 ,

t0,3 = t0 + 0.95/2 = 1.4750 ,

y0,4 = y0 = 1 + 0.95f (t0,3, y0,3) = 1.2360 ,

t0,4 = t0 + 0.95 = 1.9500 ,

y1 = y0 + 0.95(f(t0,1 , y0,1 ) + 2f (t0,2, y0,2 ) + 2f(t0,3 , y0,3) + f (t0,4 , y0,4))/6 =


1 + 0.95(0.2500 + 2 0.0642 + 2 0.2484 + 0.8281)/6 = 1.1905
t1 = t0 + h = 1.9500
- pentru n = 2:
y1,1 = y1 = 1.1905 ,

t1,1 = t1 = 1.95 ,

y1,2 = y1 = 1 + 0.95f (t1,1, y1,1)/2 = 1.5425 ,

t1,2 = t1 + 0.95/2 = 2.4250 ,

y1,3 = y1 = 1 + 0.95f (t1,2, y1,2)/2 = 1.9984 ,

t1,3 = t1 + 0.95/2 = 2.4250 ,

y1,4 = y1 = 1 + 0.95f (t1,3, y1,3) = 4.1612 ,

t1,4 = t1 + 0.95 = 2.9 ,

y2 = y1 + 0.95(f(t1,1 , y1,1 ) + 2f (t1,2, y1,2 ) + 2f(t1,3 , y1,3) + f (t1,4 , y1,4))/6 =


1.1905 + 0.95(0.7411 + 2 1.7008 + 2 3.1270 + 15.8509)/6 = 5.3464
t2 = t1 + h = 2.9 . 

Metode n mai multi pasi (indirecte)


Metoda Adams-Bashforth
l
Exemplul -1.39 Folosind metoda Adams-Bashforth pentru r = 3, determinati solutia
aproximativa a problemei Cauchy:

y = y2 y 1 ,
t 4t2
y(1) = 0.75

t [1, 2.25]

n t = 2.25 pentru N = 5, determinnd valorile de nceput y1, y2 , y3 cu metoda Euler


progresiv
a.
43

Avem h = 0.25 si f(t, y) = y 2

1
y
2 . Aplicnd metoda Euler progresiv
a se
t
4t

obtine:
t0 = 1 ,

y0 = 0.75 ,

f0 = f(t0 , y0 ) = 0.4375 ,

t1 = 1.25 ,

y1 = 0.6406 ,

f1 = f(t1 , y1 ) = 0.2621 ,

t2 = 1.5 ,

y2 = 0.5751 ,

f2 = f(t2 , y2 ) = 0.1638 ,

t3 = 1.75 ,

y3 = 0.5342 ,

f3 = f(t3 , y3 ) = 0.1015 ,

si, n continuare, cu metoda Adams-Bashforth pentru r = 3, rezulta:


t4 = 2 ,

y4 = y3 +

h
(55f3 59f2 + 37f1 9f0) = 0.5166 ,
24

f4 = f(t4, y4 ) = 0.0539 ,
t5 = 2.25 ,

y5 = y4 +

h
(55f4 59f3 + 37f2 9f1) = 0.5096 ,
24

f5 = f(t5, y5 ) = 0.0162 .

44

S-ar putea să vă placă și