免费的小说阅读器有哪些:cos(x)cos(2x)=1/4 求x 怎么做?过程!

来源:百度文库 编辑:神马品牌网 时间:2024/04/26 16:30:28

#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int main(int argc, char *argv[])
{
double fOld=0, fNew=1;
while((fabs(fOld-fNew))>1e-7)
{
fOld=fNew;
fNew=pow((fNew+0.25)/2, 1.0/3);
}
printf("t=%lf, x=%lf (%lf°)\n",fNew,acos(fNew),acos(fNew)/PI*180);

fNew=-1;
while((fabs(fOld-fNew))>1e-6)
{
fOld=fNew;
fNew=-pow((-fNew-0.25)/2, 1.0/3);
}
printf("t=%lf, x=%lf (%lf°)\n",fNew,acos(fNew),acos(fNew)/PI*180);

fNew=-0.1;
while((fabs(fOld-fNew))>1e-6)
{
fOld=fNew;
fNew=pow(fNew,3)*2-0.25;
}
printf("t=%lf, x=%lf (%lf°)\n",fNew,acos(fNew),acos(fNew)/PI*180);
return 0;
}
---------结果---------
t=0.809017, x=0.628319 (36.000000°)
t=-0.500000, x=2.094397 (120.000000°)
t=-0.309016, x=1.884955 (108.000000°)