编个C语言程序,用二分法求方程x^3-x^4+4x^2-1=0 在区间[0,1]内的根(精确到0.01)
编个C语言程序,用二分法求方程x^3-x^4+4x^2-1=0 在区间[0,1]内的根(精确到0.01)
日期:2017-09-16 07:13:24 人气:2
#include
#include
int main()
{
double x1=0,x2=1,x3;
double function(double);
while(fabs(x1-x2)<=0.01)
{x3=(x1+x2)/2;
if(function(x1)*function(x2)<=0)
x2=x3;
else
x1=x3;
}
printf("The root of this equation is %f\