# Help for "shapelets_hermite" routine:

## Calculate Hermite polynomials quickly.

This routine is used to calculate Hermite polynomials, as needed for Cartesian shapelets. It is faster than the built-in or astrolib routines because it contains a pre-calculated list of the analytic forms of the lowest order Hermite polynomials. Higher orders are still calculated using s recursion relation.

```; NAME:
;       SHAPELETS_HERMITE
;
; CATEGORY:
;       Mathematical functions.
;
; PURPOSE:
;       Compute the 1D Hermite polynomial Hn(x) of order n.
;       Faster than the astlib HERMITE function because it stores a
;       pre-compiled set of low-order hermite functions.
;
;       Note that there are potentially rounding errors for large values of n
;       and x, since the computation involves cancelling of large numbers.
;       However, this seems to be negligible in pratice.
;
; CALLING PROCEDURE:
;       result=shapelets_hermite(n,x)
;
; INPUTS:
;       n - order of the Hermite polynomial
;       x - can be a scalar, vector or array(coordinate grid)
;
; OUTPUTS:
;       Hn(x) - Hermite polynomial order n evaluated at position x
;               If x is of integer type, this will be a (longword/64bit) integer,
;               otherwise it is a (double precision) floating point.
;
; PROCEDURES USED:
;       shapelets_hermite_coeffs.
;
;       The version of IDL's "poly" routine built in below, takes advantage of
;       the Hermite polynomials' alternating positive and negative coefficients
;       to keep variables as low as possible, and therefore more significant
;       figures in the final answer. This is true even though the coefficients
;       can be perfectly represented in signed longword integers up to n=27,
;       because the product of the coefficients and the x values is more likely
;       to be a (double precision) floating point, and if x is large, quite a
;       few significant figures could be compromised.
;
;       Never mind, poly is written in a very clever way which already makes
;       sure that any coefficient is never multiplied by x^n where n is large
;       without being summed along the way.
;
; MODIFICATION HISTORY:
;       Jan 09 - Sped up further by embedding poly & adding coeffs to 25 by RM.
;       Jul 05 - Sped up by RM using IDL's built-in poly function.
;       Oct 03 - Number of hardwired coeffs increased to 20 by R. Massey
;       Jul 99 - Written by A. Refregier
```