diff options
Diffstat (limited to 'transverse/hermitepoly.m')
-rw-r--r-- | transverse/hermitepoly.m | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/transverse/hermitepoly.m b/transverse/hermitepoly.m new file mode 100644 index 0000000..43b77d6 --- /dev/null +++ b/transverse/hermitepoly.m @@ -0,0 +1,18 @@ +%-----------------------------------
+% Hermite Polynomial
+% (See e.g. Arfken section 13.1)
+%
+% SYNTAX y=hermitepoly(n,x)
+%-----------------------------------
+
+function y=hermitepoly(n,x)
+
+m=[0:floor(n/2)];
+
+a=factorial(n-2*m);
+b=factorial(m);
+
+y=zeros(size(x));
+for s=1:length(m)
+ y = y + factorial(n) ./ a(s) ./ b(s) .* (-1).^m(s) * (2*x).^(n-2*m(s));
+end
|