1、厄密多项式介绍
/*Hermite Polynomials(厄密多项式)是这样定义的1 ,n <= 0Hn(x)= 2x ,n = 12xHn-1(x) - 2(n-1)Hn-2(x) ,n >= 2*/
2、代码实现
#include <stdio.h>/*Hermite Polynomials(厄密多项式)是这样定义的1 ,n <= 0:xHn(x)= 2x ,n = 12xHn-1(x) - 2(n-1)Hn-2(x) ,n >= 2*/
int hermite(int n, int x)
{if (n <= 0)return 1;if (n == 1)return 2 * x;return 2 * x * hermite(n - 1, x) - 2 * (n - 1) * hermite(n - 2, x);
}int main()
{int result = hermite(2, 4);printf("result is %d\n", result);return 0;
}
3、运行结果
1111deMacBook-Pro:dabian a1111$ vim hermite.c
1111deMacBook-Pro:dabian a1111$ gcc -g hermite.c -o hermite
1111deMacBook-Pro:dabian a1111$ ./hermite
result is 62