#include <iostream>
#include <iomanip>
usingnamespace std;
double H( unsigned n, double x ) // "Physicist's" Hermite polynomial
{
if ( n == 0 ) return 1;
if ( n == 1 ) return 2 * x;
return 2 * x * H( n - 1, x ) - 2 * ( n - 1 ) * H( n - 2, x );
}
double He( unsigned n, double x ) // "Probabilist's" Hermite polynomial
{
if ( n == 0 ) return 1;
if ( n == 1 ) return x;
return x * He( n - 1, x ) - ( n - 1 ) * He( n - 2, x );
}
//==========================================================
int main()
{
constint n = 4; // e.g.
#define SW << setw( 12 ) <<
cout SW "x" SW "H(x)" SW "He(x)" << '\n';
for ( int i = 0; i <= 10; i++ )
{
double x = i;
cout SW x SW H( n, x ) SW He( n, x ) << '\n';
}
}