I need to calculate a quadrature rule with maximum degree of accuracy that looks like this:

$$\int_0^\infty e^{-x}f(x)dx = A_1f(x_1) + A_2f(x_2) + R(f)$$

where $f(x) = cox(x)$, presumably.

Questions:

1) Can this be solved in a general manner, for any single variable function?

2) If $f(x) = cos(x)$, is there a systematic way to split the calculation into two intervals, or do I have to guess, based on how the graph for $e^{-x}cos(x)$ looks like?

PS: In case it's not obvious, I'm in over my head with this, so thanks for the patience.

Try the following approach using orthogonal polynomials $e^{-x}$ is the weight function of the Laguerre polynomials $$\phi_j(x)=\frac{e^x}{j!}\frac{d^j}{dx^j}(e^{-x}x^j)$$ Hence, you should write out $\phi_2$ and take its roots as node points $x_1$, $x_2$. Expand $f$ as follows: $$f(x)=l_1(x)f(x_1)+l_2(x)f(x_2)$$ where $l_i$ are the basis polynomials of the Lagrange interpolation method. Substituting this expansion in the integral we find that the coefficients are determined as follows: $$A_i=\int_0^{\infty}e^{-x}l_i(x)dx$$
• Thanks; Laguerre polinomials do seem to be the ticket, but I think you're missing a $\frac{1}{j!}$ in the first formula. – scribu May 25 '12 at 2:05