hoffman@hdsvx1.UUCP (Richard Hoffman) (10/20/86)
In article <220@sri-arpa.ARPA> anderson@nrl-csr (Paul Anderson) writes: >I need to obtain an approximation to a function over the range [0,x] using >a Gauss-Legendre quadrature routine. I can find references to tables where >the weights are given over the interval [-1,1], but not over the interval [0,x] >where x will be a variable real number greater than zero, but specified prior >to the integration. The reason you can only find them on the range [-1,1] is that any function on any other range can be transformed into a function on the range [-1,1]. Thus, if your function is f(x) on the range [0,k], then let g(x) = k(x+1)/2, and interpolate the function f(g(x)) on the range [-1,1]. Alternately, you can use g(x) to transform the quadrature points into points in [0,k]. This might be more efficient if you have many functions to evaluate over the same range. -- Richard Hoffman | "They sought it with thimbles, they sought it with care, Schlumberger WS | They pursued it with forks and hope; hdsvx1!hoffman | They threatened its life with a railway share, 713-928-4750 | They charmed it with smiles and soap." (L. CARROLL)