logo

Crowdly

In programul de mai jos se ia o functie la tema Metoda coardelor. Scrieti instru...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

In programul de mai jos se ia o functie la tema Metoda coardelor. Scrieti instructiunea ce lipseste:

#include<iostream.h>

#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 (

Răspuns 24 întrebare

)

{

while ( (i<=iter) && ((y<-eps) || (y>eps)) )

{

x=x0-f(x0)*(x1-x0)/(f(x1)-f(x0));

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";

}

More questions like this

Want instant access to all verified answers on moodle1.ceiti.md?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!