implemented Hermite polynomials

This commit is contained in:
2021-10-05 17:15:47 +02:00
parent 7aae1df938
commit 59f3bb9eea
3 changed files with 30 additions and 1 deletions

View File

@@ -23,6 +23,7 @@
#include "la_traits.h"
#include "vec.h"
#include "nonclass.h"
#include "matexp.h"
namespace LA {
@@ -223,5 +224,20 @@ return p*q/poly_gcd(p,q,thr);
}
template <typename T>
Polynomial<T> hermite_polynomial(int n) //physicists definition
{
Polynomial<T> h(n);
h.clear();
h[n]=ipow((T)2,n);
for(int m=1; n-2*m>=0; m+=1)
{
int i=n-2*m;
h[i] = (-h[i+2] *(i+2)*(i+1)) /(4*m);
}
return h;
}
}//namespace
#endif