标签:
/*编写递归函数编写厄密多项式,函数应该和下面的函数原型匹配:
int hermite(int n, int x)
厄密多项式是这样定义的:
n <= 0时,h(n(x)) = 1;
n = 1时,h(n(x)) = 2*x;
n >= 2时,h(n(x)) = 2*x*(h(n-1)(x)) - 2*(n-1)*(h(n-2)(x));
编写递归函数,函数应该和下面的函数原型匹配:
int hermite(int n, int x)*/
#include <stdio.h>
int hermite(int n, int x)
{
int h = 0;
if( n <= 0 )
h = 1;
else if( n == 1 )
h = 2 * x;
else
h = 2 * x * hermite( n - 1, x ) - 2 * ( n - 1 ) * hermite( n - 2, x );
return h;
}
int main()
{
printf("%d\n",hermite(4,3));
return 0;
}
<img src="http://img.blog.csdn.net/20150405212703924?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZG91ZG91d2ExMjM0/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
标签:
原文地址:http://blog.csdn.net/doudouwa1234/article/details/44891679