Documente Academic
Documente Profesional
Documente Cultură
Info
Info
x f(x)
-20 -8036,5
-19 -6893,5
-18 -5864,5
-17 -4943,5
-16 -4124,5
-15 -3401,5
-14 -2768,5
-13 -2219,5
-12 -1748,5
-11 -1349,5
-10 -1016,5
-9 -743,5
-8 -524,5
-7 -353,5
-6 -224,5
-5 -131,5
-4 -68,5
-3 -29,5
-2 -8,5
-1 0,5
0 3,5
1 6,5
2 15,5
3 36,5
4 75,5
5 138,5
6 231,5
7 360,5
8 531,5
9 750,5
10 1023,5
11 1356,5
12 1755,5
13 2226,5
14 2775,5
15 3408,5
16 4131,5
17 4950,5
18 5871,5
19 6900,5
20 8043,5
x f(x)
-20 -8801
-19 -7582
-18 -6481 f(x)=x^3-2x^2-1
-17 -5492
-16 -4609
-15 -3826
-14 -3137
-13 -2536
-12 -2017
-11 -1574
-10 -1201
-9 -892
-8 -641
-7 -442
-6 -289
-5 -176
-4 -97
-3 -46
-2 -17
-1 -4
0 -1
1 -2
2 -1
3 8
4 31
5 74
6 143
7 244
8 383
9 566
10 799
11 1088
12 1439
13 1858
14 2351
15 2924
16 3583
17 4334
18 5183
19 6136
20 7199
Scrierea programului
Metoda1bis ex9
Program Metoda1bis;
var a,b,c:real;
i,n:integer;
function f(x:real):real;
begin
f:=x*x*x+2*x+3.5;
end;
begin
a:=-2; b:=-1; n:=30;
for i:=1 to n do
begin
c:=(b+a)/2;
writeln('i= ',i:3,' x= ',c:10:8,' f(x)= ',f(c):12:8);
if f(c)=0 then break
else if f(c)*f(a)>0
then a:=c else b:=c;
end;
end.
Testarea programului
i= 22 x= -1.09447598 f(x)= -0.00000032
i= 23 x= -1.09447587 f(x)= 0.00000034
i= 24 x= -1.09447592 f(x)= 0.00000001
i= 25 x= -1.09447595 f(x)= -0.00000016
i= 26 x= -1.09447594 f(x)= -0.00000007
i= 27 x= -1.09447593 f(x)= -0.00000003
i= 28 x= -1.09447593 f(x)= -0.00000001
i= 29 x= -1.09447593 f(x)= 0.00000000
i= 30 x= -1.09447593 f(x)= 0.00000000
Scrierea programului
Metoda2bis ex9
program Met2bis;
var a,b,c,eps:real;
function f(x:real):real;
begin
f:=x*x*x+2*x+3.5;
end;
begin
a:=-2; b:=-1; eps:=0.00000001;
repeat
c:=(b+a)/2;
writeln('x= ',c:10:8,' f(x)= ',f(c):12:8);
if f(c)=0 then break
else if f(c)*f(a)>0
then a:=c else b:=c;
until abs(b-a)<eps;
end.
Testarea programului
x= -1.50000000 f(x)= -2.87500000
x= -1.25000000 f(x)= -0.95312500
x= -1.12500000 f(x)= -0.17382813
x= -1.06250000 f(x)= 0.17553711
x= -1.09375000 f(x)= 0.00405884
x= -1.10937500 f(x)= -0.08407211
x= -1.10156250 f(x)= -0.03980494
x= -1.09765625 f(x)= -0.01782280
x= -1.09570313 f(x)= -0.00686944
x= -1.09472656 f(x)= -0.00140217
x= -1.09423828 f(x)= 0.00132912
x= -1.09448242 f(x)= -0.00003633
x= -1.09436035 f(x)= 0.00064644
x= -1.09442139 f(x)= 0.00030507
x= -1.09445190 f(x)= 0.00013437
x= -1.09446716 f(x)= 0.00004902
x= -1.09447479 f(x)= 0.00000634
x= -1.09447861 f(x)= -0.00001499
x= -1.09447670 f(x)= -0.00000432
x= -1.09447575 f(x)= 0.00000101
x= -1.09447622 f(x)= -0.00000166
x= -1.09447598 f(x)= -0.00000032
x= -1.09447587 f(x)= 0.00000034
x= -1.09447592 f(x)= 0.00000001
x= -1.09447595 f(x)= -0.00000016
x= -1.09447594 f(x)= -0.00000007
x= -1.09447593 f(x)= -0.00000003
Scrierea programului
Metoda1coarde ex9
Program Met1coard;
var a,b,c,e,x:real;
i,n:integer;
function f(x:real):real;
begin
f:=x*x*x+2*x+3.5;
end;
begin
a:=-1; b:=-2; n:=32;
c:=a-(f(a))/(f(b)-f(a))*(b-a);
if f(c)*f(a)>0
then begin e:=b; x:=a;
end
else begin e:=a; x:=b;
end;
for i:=1 to n do
begin x:=x-(f(x))/(f(e)-f(x))*(e-x);
writeln(x:10:8,' ',f(x):12:8);
end;
end.
Testarea programului
-1.05555556 0.21279150
-1.07862161 0.08786187
-1.08804818 0.03581908
-1.09187502 0.01452630
-1.09342434 0.00587856
-1.09405089 0.00237690
-1.09430416 0.00096073
-1.09440651 0.00038827
-1.09444788 0.00015690
-1.09446459 0.00006341
-1.09447135 0.00002562
-1.09447408 0.00001035
-1.09447518 0.00000418
-1.09447562 0.00000169
-1.09447580 0.00000068
-1.09447588 0.00000028
-1.09447591 0.00000011
-1.09447592 0.00000005
-1.09447592 0.00000002
-1.09447593 0.00000001
-1.09447593 0.00000000
-1.09447593 0.00000000
-1.09447593 0.00000000
-1.09447593 0.00000000
-1.09447593 0.00000000
-1.09447593 0.00000000
-1.09447593 0.00000000
-1.09447593 0.00000000
-1.09447593 0.00000000
-1.09447593 0.00000000
-1.09447593 0.00000000
-1.09447593 0.00000000
Scrierea programului
Metoda2coarde ex9
program Met2coard;
var Msup,minf,a,b,c,e,x,xnou,xvechi,eps:real;
function f(x:real):real;
begin
f:=x*x*x+2*x+3.5;
end;
begin
a:=1; b:=2; eps:=0.00000001;
Msup:=11; minf:=18;
x:=a-(f(a))/(f(b)-f(a))*(b-a);
if f(x)*f(a)>0
then begin e:=b; xnou:=a;
end
else begin e:=a; xnou:=b;
end;
repeat
xvechi:=xnou;
xnou:=xvechi-(f(xvechi))/(f(e)-f(xvechi))*(e-xvechi);
writeln('x=',xnou:10:8,'f(x)= ',f(xnou):12:8);
until abs((Msup-minf)/minf*(xnou-xvechi))<eps;
end.
Testarea programului
x=0.27777778f(x)= 4.07698903
x=-0.33690088f(x)= 2.78795924
x=-0.84942161f(x)= 1.18828457
x=-1.08600567f(x)= 0.04714452
x=-1.09542065f(x)= -0.00528736
x=-1.09436510f(x)= 0.00061989
x=-1.09448886f(x)= -0.00007232
x=-1.09447442f(x)= 0.00000844
x=-1.09447610f(x)= -0.00000099
x=-1.09447591f(x)= 0.00000012
x=-1.09447593f(x)= -0.00000001
Scrierea programului
Metoda1bis ex24
Program Met1bis;
var a,b,c:real;
i,n:integer;
function f(x:real):real;
begin
f:= x*x*x-2*sqr(x)-1;
end;
begin
a:=-2; b:=-1; n:=30;
for i:=1 to n do
begin
c:=(b+a)/2;
writeln('i= ',i:3,' x= ',c:10:8,' f(x)= ',f(c):12:8);
if f(c)=0 then break
else if f(c)*f(a)>0
then a:=c else b:=c;
end;
end.
Testarea programului
i= 1 x= -1.50000000 f(x)= -8.87500000
i= 2 x= -1.25000000 f(x)= -6.07812500
i= 3 x= -1.12500000 f(x)= -4.95507813
i= 4 x= -1.06250000 f(x)= -4.45727539
i= 5 x= -1.03125000 f(x)= -4.22366333
i= 6 x= -1.01562500 f(x)= -4.11059952
i= 7 x= -1.00781250 f(x)= -4.05499315
i= 8 x= -1.00390625 f(x)= -4.02742010
i= 9 x= -1.00195313 f(x)= -4.01369096
i= 10 x= -1.00097656 f(x)= -4.00684071
i= 11 x= -1.00048828 f(x)= -4.00341916
i= 12 x= -1.00024414 f(x)= -4.00170928
i= 13 x= -1.00012207 f(x)= -4.00085457
i= 14 x= -1.00006104 f(x)= -4.00042726
i= 15 x= -1.00003052 f(x)= -4.00021363
i= 16 x= -1.00001526 f(x)= -4.00010681
i= 17 x= -1.00000763 f(x)= -4.00005341
i= 18 x= -1.00000381 f(x)= -4.00002670
i= 19 x= -1.00000191 f(x)= -4.00001335
i= 20 x= -1.00000095 f(x)= -4.00000668
i= 21 x= -1.00000048 f(x)= -4.00000334
i= 22 x= -1.00000024 f(x)= -4.00000167
i= 23 x= -1.00000012 f(x)= -4.00000083
i= 24 x= -1.00000006 f(x)= -4.00000042
i= 25 x= -1.00000003 f(x)= -4.00000021
i= 26 x= -1.00000001 f(x)= -4.00000010
i= 27 x= -1.00000001 f(x)= -4.00000005
i= 28 x= -1.00000000 f(x)= -4.00000003
i= 29 x= -1.00000000 f(x)= -4.00000001
i= 30 x= -1.00000000 f(x)= -4.00000001
Scrierea programului
Metoda2bis ex24
program Met2bis;
var a,b,c,eps:real;
function f(x:real):real;
begin
f:= x*x*x-2*sqr(x)-1;
end;
begin
a:=-2; b:=-1; eps:=0.00000001;
repeat
c:=(b+a)/2;
writeln('x= ',c:10:8,' f(x)= ',f(c):12:8);
if f(c)=0 then break
else if f(c)*f(a)>0
then a:=c else b:=c;
until abs(b-a)<eps;
end.
Testarea programului
x= -1.50000000 f(x)= -8.87500000
x= -1.25000000 f(x)= -6.07812500
x= -1.12500000 f(x)= -4.95507813
x= -1.06250000 f(x)= -4.45727539
x= -1.03125000 f(x)= -4.22366333
x= -1.01562500 f(x)= -4.11059952
x= -1.00781250 f(x)= -4.05499315
x= -1.00390625 f(x)= -4.02742010
x= -1.00195313 f(x)= -4.01369096
x= -1.00097656 f(x)= -4.00684071
x= -1.00048828 f(x)= -4.00341916
x= -1.00024414 f(x)= -4.00170928
x= -1.00012207 f(x)= -4.00085457
x= -1.00006104 f(x)= -4.00042726
x= -1.00003052 f(x)= -4.00021363
x= -1.00001526 f(x)= -4.00010681
x= -1.00000763 f(x)= -4.00005341
x= -1.00000381 f(x)= -4.00002670
x= -1.00000191 f(x)= -4.00001335
x= -1.00000095 f(x)= -4.00000668
x= -1.00000048 f(x)= -4.00000334
x= -1.00000024 f(x)= -4.00000167
x= -1.00000012 f(x)= -4.00000083
x= -1.00000006 f(x)= -4.00000042
x= -1.00000003 f(x)= -4.00000021
x= -1.00000001 f(x)= -4.00000010
x= -1.00000001 f(x)= -4.00000005
Scrierea programului
Metoda1coarde ex24
Program Met1coard;
var a,b,c,e,x:real;
i,n:integer;
function f(x:real):real;
begin
f:= x*x*x-2*sqr(x)-1;
end;
begin
a:=-1; b:=-2; n:=32;
c:=a-(f(a))/(f(b)-f(a))*(b-a);
if f(c)*f(a)>0
then begin e:=b; x:=a;
end
else begin e:=a; x:=b;
end;
for i:=1 to n do
begin x:=x-(f(x))/(f(e)-f(x))*(e-x);
writeln(x:10:8,' ',f(x):12:8);
end;
end.
Testarea programului
-0.69230769 -2.29039599
-0.48869016 -1.59434420
-0.33228344 -1.25751275
-0.19906594 -1.08714293
-0.07602878 -1.01200023
0.04575376 -1.00409103
0.17416929 -1.05538646
0.31807925 -1.17016734
0.48943550 -1.36185135
0.70622849 -1.64527977
0.99620466 -1.99619031
1.39483640 -2.17738729
1.89352538 -1.38175818
2.23798865 0.19198831
2.19066170 -0.08501474
2.21172397 0.03569502
2.20289912 -0.01537836
2.20670454 0.00655706
2.20508260 -0.00280855
2.20577743 0.00120066
2.20548041 -0.00051371
2.20560750 0.00021971
2.20555315 -0.00009399
2.20557640 0.00004020
2.20556645 -0.00001720
2.20557070 0.00000736
2.20556889 -0.00000315
2.20556966 0.00000135
2.20556933 -0.00000058
2.20556947 0.00000025
2.20556941 -0.00000011
2.20556944 0.00000005
Scrierea programului
Metoda2coarde ex24
program Met2coard;
var Msup,minf,a,b,c,e,x,xnou,xvechi,eps:real;
function f(x:real):real;
begin
f:= x*x*x-2*sqr(x)-1;
end;
begin
a:=1; b:=2; eps:=0.00000001;
Msup:=11; minf:=18;
x:=a-(f(a))/(f(b)-f(a))*(b-a);
if f(x)*f(a)>0
then begin e:=b; xnou:=a;
end
else begin e:=a; xnou:=b;
end;
repeat
xvechi:=xnou;
xnou:=xvechi-(f(xvechi))/(f(e)-f(xvechi))*(e-xvechi);
writeln('x=',xnou:10:8,'f(x)= ',f(xnou):12:8);
until abs((Msup-minf)/minf*(xnou-xvechi))<eps;
end.
Testarea programului
x=3.00000000f(x)= 8.00000000
x=1.40000000f(x)= -2.17600000
x=-3.54545455f(x)= -70.70773854
x=1.13231274f(x)= -2.11248972
x=-1.35244135f(x)= -7.13194247
x=1.91678399f(x)= -1.30574068
x=3.64104194f(x)= 20.75559888
x=1.23212238f(x)= -2.16573464
x=-1.80113295f(x)= -13.33117898
x=1.49441156f(x)= -2.12911343
x=-6.65856153f(x)= -384.88980868
x=1.04000400f(x)= -2.03833966
x=-1.08682075f(x)= -4.64608893
x=2.57728694f(x)= 2.83457534
x=1.65250278f(x)= -1.94893339
x=26.55496820f(x)= 17314.33695084
x=1.00295154f(x)= -2.00294281
x=-1.00593809f(x)= -4.04174315
x=2.96492697f(x)= 7.48247229
x=1.41443348f(x)= -2.17149730
x=-3.83311941f(x)= -86.70488271
x=1.11411667f(x)= -2.09960796
x=-1.29131630f(x)= -6.48826269
x=2.02102593f(x)= -0.91411861
x=2.88054780f(x)= 6.30639439
x=1.45279521f(x)= -2.15493805
x=-4.84485501f(x)= -161.66668146
x=1.07321321f(x)= -2.06746060
x=-1.17054724f(x)= -5.34422307
x=2.29808759f(x)= 0.57426217
x=2.00851235f(x)= -0.96566015
x=2.95005992f(x)= 7.26823239
x f(x)
-20 -8036,5
-19 -6893,5
-18 -5864,5
-17 -4943,5
-16 -4124,5
-15 -3401,5
-14 -2768,5
-13 -2219,5
-12 -1748,5
-11 -1349,5
-10 -1016,5
-9 -743,5
-8 -524,5
-7 -353,5
-6 -224,5
-5 -131,5
-4 -68,5
-3 -29,5
-2 -8,5
-1 0,5
0 3,5
1 6,5
2 15,5
3 36,5
4 75,5
5 138,5
6 231,5
7 360,5
8 531,5
9 750,5
10 1023,5
11 1356,5
12 1755,5
13 2226,5
14 2775,5
15 3408,5
16 4131,5
17 4950,5
18 5871,5
19 6900,5
20 8043,5
Concluzie:
In aceata lucrare de laborator am rezolvat ecuatii cu ajutorul metodei
analitice si grafice. Am intocmit programele dupa dupa care le-am testat.
Astfel am obtinut numarul de divizari si solutii.
Misiterul Educației și Cercetării al Republicii Moldova
Centrul de Excelență în Economie și Finanțe
Chișinău 2019