C语言牛顿迭代法求方程根不知哪里错了#include #include #define e 1.0e-6 f(double x) { double y; y=2*x*x*x-4*x*x+3*x-6; return y;} f1(double x) { double y; y=6*x*x-8*x+3; return y;} main() { double d=1,x=1.5; while(fabs(d)>e) {d=f(x)/f1
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/19 10:29:53
C语言牛顿迭代法求方程根不知哪里错了#include #include #define e 1.0e-6 f(double x) { double y; y=2*x*x*x-4*x*x+3*x-6; return y;} f1(double x) { double y; y=6*x*x-8*x+3; return y;} main() { double d=1,x=1.5; while(fabs(d)>e) {d=f(x)/f1
C语言牛顿迭代法求方程根不知哪里错了
#include #include #define e 1.0e-6 f(double x) { double y; y=2*x*x*x-4*x*x+3*x-6; return y;} f1(double x) { double y; y=6*x*x-8*x+3; return y;} main() { double d=1,x=1.5; while(fabs(d)>e) {d=f(x)/f1(x);x=x-d;} printf("%f",d); }
额没排版
#include
#include
#define e 1.0e-6
f(double x)
{double y;
y=2*x*x*x-4*x*x+3*x-6;
return y;}
f1(double x)
{double y;
y=6*x*x-8*x+3;
return y;}
main()
{
double d=1,x=1.5;
while(fabs(d)>e)
{d=f(x)/f1(x);x=x-d;}
printf("%f",d);
}
C语言牛顿迭代法求方程根不知哪里错了#include #include #define e 1.0e-6 f(double x) { double y; y=2*x*x*x-4*x*x+3*x-6; return y;} f1(double x) { double y; y=6*x*x-8*x+3; return y;} main() { double d=1,x=1.5; while(fabs(d)>e) {d=f(x)/f1
f、f1两个函数定义的时候没有标明返回值的类型
看样子应该是
double f(double x){}
double f1(double x){}