Use recursive functions to calculate ermi polynomials and recursive Polynomials
Chapter 2 of C and pointers: 7th programming questions:
Hermite Polynomials is defined as follows:
For example, the value of H3 (2) is 40. Compile a recursive function to calculate the Hn (x) value. Function prototype:
Int hermite (int n, int x );
1/* 2 ** calculate the Hermite Polynomials (ermi polynomial) value 3 */4 5 # include <stdio. h> 6 7 int hermite (int n, int x); 8 9 int 10 main () 11 {12 int n, x; 13 scanf ("% d ", & n, & x); 14 printf ("% d", hermite (n, x); 15 return 0; 16} 17 18/* 19 ** calculate the value of the ermi polynomial. Recursive Function version 20 */21 int 22 hermite (int n, int x) 23 {24 int result; 25 26 if (n <= 0) 27 result = 1; 28 else {29 if (n = 1) 30 result = 2 * x; 31 else32 result = 2 * x * hermite (n-1, x) 33-2 * (n-1) * hermite (n-2, x ); 34} 35 return result; 36}