Documente Academic
Documente Profesional
Documente Cultură
Integrare numerica
sin x
x
A) Metoda dreptunghiului de integrare numerica
( 2)
sin x
y( x) :=
a := 0.5 b := 4
n := 20
h :=
<---Nr. de noduri
ba
0.5
y( x)
4 2
0.5
IntegD( y , a , b , n ) :=
S0
h
ba
n
Algoritmul metodei
for x a , a + h .. b h
S S + y x +
S
b
ValoareaExacta := y( x) dx
IntDrept := IntegD( y, a , b , n )
IntDrept = 0.762
ValoareaExacta = 0.762
EroareRelativa :=
EroareAbsoluta = 5.315 10
( IntDrept ValoareaExacta)
ValoareaExacta
100
EroareRelativa = 0.07
S0
ba
Algoritmul metodei
for x a , a + h .. b h
SS+
( y( x) + y( x + h ) ) h
2
S
b
IntTrapez := IntegT( y , a , b , n )
ValoareaExacta := y( x) dx
IntTrapez = 0.761
ValoareaExacta = 0.762
EroareAbsoluta = 1.03 10
EroareRelativa :=
( IntTrapez ValoareaExacta)
EroareRelativa = 0.135
ValoareaExacta
100
Metode Numerice
x := a , a + h .. b
y( x)
0.5
y( x)
2.25
1
x
n 2m
h
ba
n
for i 0 .. n 1
Algoritmul metodei
( Metoda se aplica numai daca 2m > n)
m1
s1
y( a + 2 i h )
i=1
m
s2
y[ a + ( 2 i 1) h]
i=1
S ( y( a) + y( b) + 2 s1 + 4 s2)
h
3
S
n := 20
m := 15
ValoareaExacta := y( x) dx
IntSimpson := IntegSim( y, a , b , m)
IntSimpson = 0.762
ValoareaExacta = 0.762
EroareRelativa :=
EroareAbsoluta = 3.584 10
h :=
( IntSimpson ValoareaExacta)
ValoareaExacta
3
EroareRelativa = 4.704 10
ba
x := a , a + h .. b
2m
1
y( x)
y( x)
0.5
2.25
1
x
100
Metode Numerice
Aplicatie 2 .
Debitul de apa murdara evacuat intr-un canal deschis a fost masurat obtinandu-se urmatoarele date:
665
705
780
830
870
890
Debit := 870
800
725
670
640
620
610
0
10
20
30
40
50
Timp := 60
70
80
90
100
110
120
Sa se determine debitul total de apa in m3 ce trece in intervalul timp masurat prin canal.
0
y := Debit
0
x := Timp
Presupunem ca
3
y = a x + b x3 + c x + d
x
x2
Y( x) :=
x1
1.5
S := linfit ( x , y , Y)
8.421 10 4
0.212
S=
13.068
418.004
yreg( x) := Y( x) S
z := min( x) .. max( x)
800
Debit 600
yreg( z) 400
200
0
50
Timp , z
100
Metode Numerice
IntegSim( y , a , b , m) :=
n 2m
h
ba
n
for i 0 .. n 1
m1
s1
y( a + 2 i h )
i=1
m
s2
y[ a + ( 2 i 1) h]
i=1
S ( y( a) + y( b) + 2 s1 + 4 s2)
h
3
S
a := 0
b := 120
m := 20
x := a , a + 10 .. b
1 10
yreg( x)
700
yreg( x)
400
60
120
Aplicatie 3. In urma cercetarilor experimentale s-au obtinut urmatoarele date experimentale pentru
functia y=f(x):
x
f(x)
Date :=
0
100
0.1
75
0.2
60.5
0.3
53.5
0.4
53
0.5
60
0.6
72.5
Metode Numerice
1
f ( x) := Date
100
90
80
f ( x)
70
60
50
0.2
0.4
0.6
x
2
x2
F( x) := x
1
a
b := linfit ( x , f ( x) , F)
c
a
Coeficientii := b
c
366.667
Coeficientii = 262.857
98.976
yapr( x) := F( x) Coeficientii
------->
IntegSim( y , a , b , m) :=
------->
coeficientul de corelatie
n 2m
h
ba
n
for i 0 .. n 1
m1
s1
y( a + 2 i h )
i=1
m
s2
y[ a + ( 2 i 1) h]
i=1
S ( y( a) + y( b) + 2 s1 + 4 s2)
S
h
3
Metode Numerice
a := 0
b := 0.6
b
ValoareaExacta := yapr ( x) dx
A := IntegSim yapr , a , b , m
ValoareaExacta = 38.471
A = 38.471
x := a , a + 0.1 .. b
100
yapr( x)
70
yapr( x)
40
0.35
0.7