c语言poly函数怎么算 c语言中 pow

C语言里面poly函数怎么用?具体如下c语言poly函数怎么算:
函数名:
poly

能:
根据参数产生一个多项式

法:
double
poly(double
x,
int
n,
double
c[]);
程序例:
#include
stdio.h
#include
math.h
/*
polynomial:
x**3
-
2x**2
5x
-
1
*/
int
main(void)
{
double
array[]
=
{
-1.0,
5.0,
-2.0,
1.0
};
double
result;
result
=
poly(2.0,
3,
array);
printf("the
polynomial:
x**3
-
2.0x**2
5x
-
1
at
2.0
is
%lf\n",
result);
return
0;
}
C语言 poly函数这个poly函数很奇怪啊,除了百度百科里有点介绍外,其他地方影都没有,我的c函数库里是没有这个东西 , 我怀疑他的存在性,个人见解
C的poly函数#includeiostream
using namespace std;
double poly(double x,unsigned n)
{
if(n==0) return 1;
if(n==1)
{
poly(x,n)=x;
return x;
}
if(n1)return (((2n-1)*x*poly(x,n-1)-(n-1)*poly(x,n-2))/n);
}
int main()
{
double x;
unsigned n;
cinxn;
coutendl;
coutpoly(x,n)endl;
return 0;
}
【c语言poly函数怎么算 c语言中 pow】c语言poly函数怎么算的介绍就聊到这里吧,感谢你花时间阅读本站内容 , 更多关于c语言中 pow、c语言poly函数怎么算的信息别忘了在本站进行查找喔 。

    推荐阅读