c程序设计第四版谭浩强
用牛顿迭代法求下面方程在1.5附近的根:
2x3-4x2+3x-6=0
c程序设计第四版谭浩强课后答案
以下是此题的【c源代码】,需要【c++源代码】请点击进入
#include <stdio.h>
#include <math.h>
int main()
{double x1,x0,f,f1;
x1=1.5;
do
{x0=x1;
f=((2*x0-4)*x0+3)*x0-6;
f1=(6*x0-8)*x0+3;
x1=x0-f/f1;
}while(fabs(x1-x0)>=1e-5);
printf("The root of equation is %5.2f\n",x1);
return 0;
}
本文链接:http://www.wb98.com/c/post/tanhaoqiang_5.14.html
本站文章搜索: