c/school/ch05_5-14.c · 251 字节 · 下载原文
#include <stdio.h>
#include <math.h> // pow fabs
int main(){
double x1=0,x2,f1,f2;
x2=1.5;
while(fabs(x2-x1)>=1e-6){
x1=x2;
f1=2*pow(x1,3)-4*pow(x1,2)+3*x1-6;
f2=6*pow(x1,2)-8*x1+3;
x2=x1-f1/f2;
}
printf("%f",x1);
return 0;
}