递归求解1-x^2/3!+x^4/5!-x^6/7!+……+(-1)^n*x^2n/(2n+1)!
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/10 19:58:14
递归求解1-x^2/3!+x^4/5!-x^6/7!+……+(-1)^n*x^2n/(2n+1)!
要求算法代码 急
要求算法代码 急
#include "stdio.h"
#include "math.h"
double sum(double x,double n,double s)
{
double jc=1;
double ss=pow(x,2*n);
if(n>-1)
{
for(double i=1;i<=2*n+1;i++)
jc=jc*i;
return sum(x,n-1,s+pow(-1,n)*ss/jc);
}
else
return s;
}
int main()
{
double n,s,x;
printf("Input n,x:");
scanf("%lf,%lf",&n,&x);
s=sum(x,n,0);
printf("%lf",s);
}
#include "math.h"
double sum(double x,double n,double s)
{
double jc=1;
double ss=pow(x,2*n);
if(n>-1)
{
for(double i=1;i<=2*n+1;i++)
jc=jc*i;
return sum(x,n-1,s+pow(-1,n)*ss/jc);
}
else
return s;
}
int main()
{
double n,s,x;
printf("Input n,x:");
scanf("%lf,%lf",&n,&x);
s=sum(x,n,0);
printf("%lf",s);
}
如何编程求解递归函数表达式 L(0)=1,L(1)=1-x;L(n)=(1+2*(n-1)-x)*L(n-1)-(n-1
c语言:分别用递归法和迭代法求解(都要写成函数):s(x,n)=x^1+x^2+.+x^n
因式分解4x^(n+2)-9x^n+6x^(n-1)-x^(n-2)
求公式的递归函数f(x,n)=x-x^2+x^3-x^4+···+(-1)^(n-1)*x^n只是整数范围的运算而已~可
求和:Sn=1-3x+5x^2-7x^3+.+(2n+1)(-x)^n(n属于N*)
计算(x^(2n)+x^n+1)(x^(3n)-x^(2n)+1)
3N+2=X 5N+4=X 7N+6=X 9N+8=X 11N=X求解N X 各位哥哥姐姐叔叔阿姨帮帮忙
求和:Sn=1+3x+5x*x+7x*x*x+……+(2n-1)x^n-1 (x不为0和1)
C语言 f(x)=1+x+x^2/2!+x^3/3!+...+x^n/n!直到|x^n/n|
若多项式x^4Y^n-2x^3与多项式-1/3x^5-4y+1/5的次数相同,试探究n-2n+3n-4n+5n-6n+…
Sn=1+3x+5x^2+7x^3+…+(2n-1)*x^(n-1);
求和:Sn=1+3x+5x+7x+…+﹝2n-1﹞x^n-1