Documente Academic
Documente Profesional
Documente Cultură
Algoritmul 1
Program Bisectiei;
Var
a ,b ,eps, c :real;
Function f(x:real) : real ;
Begin f:=x*x*x+3*x*x-3; end;
Begin eps:=0.1 ;
Repeat a:=-3; b:=2;
Repeat c:= (a+b)/2 ;
If f(a)*f(c)<0 then b:=c
Else if f(a)*f(c)>0 then a:=c;
Until (f(c)=0) or (abs (a-b)< 2*eps) ;
If f(c) = 0 then writeln (‘sol exacta x=’, (a+b)/2:0:6)
Else writeln (‘sol x=’, (a+b)/2:0:6, ‘f=’, f((a+b)/2) :0:15);
Eps :=eps*0.1; until eps<0.00001;
End.
Solutii:
Sol x=0.828125f= -0.374706226831
Sol x=0.876953f= -0.01844166964
Sol x=0.878784f= -0.00456378964
Sol x=0.879318f= -0.00050895697
Sol x=0.879385f= -0.00000187677
Metode de determinare a solutiilor
ecuatiilor algebrice si
transcendente.
Metod
a
bisectie
i