Looking for Informatica an_3 P-2333 test answers and solutions? Browse our comprehensive collection of verified answers for Informatica an_3 P-2333 at moodle1.ceiti.md.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Ce asigură proprietăţile funcţiei f(x)=0 pe segmentul dat la metoda injumatatirii?
Completati regula selectind raspunsul:
Carei metode apartine urmatorul program? (In program este data o functie ce corepsunde cu tema)
#include<iostream>
#include<math.h>
#define eps 0.00000000001
#define iter 200
double f(double x)
{
return x*x*x-2*x*x*cos(x)+x-3;
}
void main()
{
unsigned char i;
double x,x0,x1,a,b,y;
cout<<"a=";cin>>a;cout<<"b=";cin>>b;
i=0;x0=a;x1=b;x=x0;y=f(x);
if (f(x0)*f(x1)<0)
{
while ( (i<=iter) && ((y<-eps) || (y>eps)) )
{
x=(x0+x1)/2;
y=f(x);
if (f(x0)*y<0) x1=x; else x0=x;
cout<<"\n\nf("<<x<<")="<<f(x)<<" la iteratia "<<(int)i;
i++;
}
if (i>iter) cout<<"problema nu se poate rezolva in nr.maxim de iteratii";
} else cout<<"interval invalid";
}
In ce caz se stopeaza procesul divizarii intervalului [a,b]?