关于用泰勒级数计算sin(x)sin(x)=x-(x3/3!)+(x5/5!)-(x7/7!)+(x9/9!)最后一项绝对值小于10e-5,#include#includevoid main(){\x05long double sum,x,b;\x05int a=1,c=1;\x05printf("Please print x");\x05scanf("%lf",&x);\x05sum=x,b=x;while (-1e-

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 02:43:17

关于用泰勒级数计算sin(x)sin(x)=x-(x3/3!)+(x5/5!)-(x7/7!)+(x9/9!)最后一项绝对值小于10e-5,#include#includevoid main(){\x05long double sum,x,b;\x05int a=1,c=1;\x05printf("Please print x");\x05scanf("%lf",&x);\x05sum=x,b=x;while (-1e-
关于用泰勒级数计算sin(x)sin(x)=x-(x3/3!)+(x5/5!)-(x7/7!)+(x9/9!)最后一项绝对值小于10e-5,
#include
#include
void main()
{
\x05long double sum,x,b;
\x05int a=1,c=1;
\x05printf("Please print x");
\x05scanf("%lf",&x);
\x05sum=x,b=x;
while (-1e-5>b||b>1e-5)
\x05{
\x05\x05b=-b*x*x/(a+1)*(a+2);
\x05\x05sum=sum+b;
\x05\x05c++;
\x05\x05a=a+2;
\x05}
\x05printf("sin(x)=%lf,%d",sum,c);
\x05system ("pause");
}
哪不对?为什么调试对的运行不出结果,我觉得我想法也没错啊

关于用泰勒级数计算sin(x)sin(x)=x-(x3/3!)+(x5/5!)-(x7/7!)+(x9/9!)最后一项绝对值小于10e-5,#include#includevoid main(){\x05long double sum,x,b;\x05int a=1,c=1;\x05printf("Please print x");\x05scanf("%lf",&x);\x05sum=x,b=x;while (-1e-
b=-b*x*x/((a+1)*(a+2));
少了一对括号