Documentos de Académico
Documentos de Profesional
Documentos de Cultura
y1= f(x1)
y2= f(x2)
y1*y2 > 0.0
No
Si
Error en el
intervalo
Return (0)
x1
x2
x3
xi+1-xi
y1
y2
y3
ea
y1==y2
Si
No
No se puede
dividir por cero
Return (0)
x3= x2-[y2*(x1-x2)/(y1-y2)]
y3=f(x3)
Si
y3==0
No
res=x3
Return (0)
El proceso
converge res=
res
2
yy11*y
==y
>0
23 2
No se puede
dividir por cero
y1= f(x1)
x1
x
x
xi+1
-xi
y1
31
i<=nit;
x1=x32 for3 (i=2;
=x
y2x=4i=1
f(x32) i++)
y
y
ea
x22Return
=x3 3 (0) 54
Si
No
No
Si
x3= x2-[y2*(x1-x2)/(y1-y2)]
y3=f(x3)
y3==0
Si
No
res=x3
Return (0)
El proceso
converge res=
res
ea= |(x3-x4)/(x3)|*100
x1
x2
x3
xi+1-xi
y1
y2
|x3-x4|<=Eps
Si
y3
ea
No
res=x3
break
El proceso
converge res=
res
Si
x1=x3
y1*y3> 0
x4=x3
No
x2=x3
Si
|x3-x4|>Eps
El sistema no
converge
fin
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
No
for (i=2;i<=nit;i++)
{
y1=f(x1);
y2=f(x2);
if (y1==y2)
{
cout<<"\nNo se puede dividir por cero\n"<<endl;
return(0);
}
x3=x2-y2*(x1-x2)/(y1-y2);
y3=f(x3);
if (y3==0)
{
res=x3;
cout<<"\nEl proceso converge res= "<<res<<"\n"<<endl;
return(0);
}
ea=fabs((x3-x4)/x3)*100;
printf("%2d %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f\n",i,x1,x2,x3,fabs(x4x3),ea,y1,y2,y3);
if (fabs(x3-x4)<=eps)
{
res=x3;
cout<<"\nEl proceso converge res= "<<res<<"\n"<<endl;
break;
}
if (y1*y3>0.0)
x1=x3;
else
x2=x3;
x4=x3;
}
if (fabs(x3-x4)>eps)
cout<<"\nEl sistema no converge\n"<<endl;
printf("\n");
system("pause");
}