File:  [CENS] / python / pyGiNaC / examples / HermitePoly.py
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Mon Nov 26 22:37:44 2001 UTC (15 years, 11 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
See NEWS.txt (impl. matrix)

#!/usr/bin/env python

from ginac import *

def HermitePoly (x,n):
    assert isinstance (x,symbol)
    HKer = exp(-x**2)
    # uses the identity H_n(x) == (-1)^n exp(x^2) (d/dx)^n exp(-x^2)
    return ((-1)**n * HKer.diff(x,n) / HKer).normal()

z=symbol('z')
for i in range (10):
    print 'H_%d(z) == %s'%(i,HermitePoly(z,i))

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>