近似值级数 如何用泰勒级数求e的近似值,要求误差小于10^(-4)
2个回答
展开全部
e=1+1+1/2!+1/3!+1/4!+……,取前八项,即可使误差小于10^(-4)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2012-04-16
展开全部
#include <math.h>
#include <stdio.h>
main()
{
int n = 1, count =1;
double e = 1.0, term = 1.0;
long fac = 1;
for (n=1; fabs(term) >= 1e-4; n++)
{
fac = fac * n;
term = 1.0 / fac;
e = e + term;
count++;
}
printf("e = %f, count = %d\n", e, count);
}
#include <stdio.h>
main()
{
int n = 1, count =1;
double e = 1.0, term = 1.0;
long fac = 1;
for (n=1; fabs(term) >= 1e-4; n++)
{
fac = fac * n;
term = 1.0 / fac;
e = e + term;
count++;
}
printf("e = %f, count = %d\n", e, count);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询