二分法的问题#include #include #include #define MIN 0.001double f (double a,double b){double c;c = (sin(a) - a*a/4) * (sin(b) - b*b/4);printf (" c is :%lf\n",c);return c;}double erfen( double a ,double b){double n;n = a - b;printf (" n is :%lf\n

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 06:20:24

二分法的问题#include #include #include #define MIN 0.001double f (double a,double b){double c;c = (sin(a) - a*a/4) * (sin(b) - b*b/4);printf (" c is :%lf\n",c);return c;}double erfen( double a ,double b){double n;n = a - b;printf (" n is :%lf\n
二分法的问题
#include
#include
#include
#define MIN 0.001
double f (double a,double b){
double c;
c = (sin(a) - a*a/4) * (sin(b) - b*b/4);
printf (" c is :%lf\n",c);
return c;
}
double erfen( double a ,double b){
double n;
n = a - b;
printf (" n is :%lf\n",n);
if (fabs(n)

二分法的问题#include #include #include #define MIN 0.001double f (double a,double b){double c;c = (sin(a) - a*a/4) * (sin(b) - b*b/4);printf (" c is :%lf\n",c);return c;}double erfen( double a ,double b){double n;n = a - b;printf (" n is :%lf\n
if (f(mid ,b) < 0)
return erfen(mid,b);
else
return erfen(a,mid);