Bug in "gauher" routine?


jamex
10-17-2003, 06:19 AM
Hi guys,

this question is concerned with:
Section 4.5: "Gaussian Quadratures..."
(p. 159 NR C++, Version 2.10)

...could it be that there is a typing error (possible bug) in the "gauher" routine (this routine computes the abscissas and weights for Gauss-Hermite quadrature) ?? When running "gauher", the elements of the abscissas-array ("x[0..n-1]") are not decreasing and the weights are also nonsense.

The flaw might be in line 10 following the first "for" loop (i.e., in the "else" clause): shouldn't it read
z=2.0*z-x[i-1]; rather than ...x[i-2]? Changing this line to ...[x-1], the routine works fine.

Has anyone also encountered this problem? Has it already been reported?
It not and if it's really a bug, this posting may seen as a bug report ;-)

Christian.

Saul Teukolsky
10-17-2003, 12:37 PM
Hi Christian,

Nobody else has reported problems with gauher, and it runs fine for me. The change you mentioned is just a change in the initial guess for the root, and so it should affect only the number of iterations taken, not whether the code works or not.

Saul Teukolsky