Two Questions Regarding Gaussian Quadrature

520 Views Asked by At

I'm learning about the Gauss-Hermite Quadrature method on my own so I apologize if these questions seem trivial, but since I haven't found any online resources which specifically answer my questions I thought I'd ask it here. In particular, I don't really understand the following things:

1) How do you know how large you should make the Hermite polynomial for a given integral? Is it best just to take a very large Hermite polynomial value to ensure greater accuracy? As I understand, it looks like taking a Hermite polynomial $H_{n}(x)$ where $n = 30$ is better than taking a polynomial where $n = 10$, the drawback however is that it would take a bit longer to compute. Can someone confirm this?

2) Can the Gauss Hermite quadrature method integrate functions when a constant is involved? Say for instance I have the equation $f(x) = \ln(x + c)$ for $c$ constant, can this method numerically integrate the function $f(x)$ properly? Or do I have to use a different method? Or is it even possible to perform numerical integration when a constant is involved?

Thanks in advance.

1

There are 1 best solutions below

3
On BEST ANSWER

1) Many times you have some form of error tolerance involved when you perform numerical calculations. This typically sets a lower bound for the $n$ you can use. Other times, the function you want to integrate comes in the form of a vector of discrete points (e.g. the numerical solution of an ODE or a PDE), in which case you are not free to choose $n$. In any case, for a Gaussian quadrature, the error is given as $$ \int_a^b w(x) f(x) \text{d}x - \sum_{i=1}^n w_i f_i = \frac{f^{(2n)}(\xi)}{(2n)!} \int_a^b w(x) H_n(x) H_n(x) \text{d}x, $$ where $\xi$ is some point in the interval $[a,b]$ and $w(x) = e^{-x^2}$. $H_n(x)$ is here the monic Hermite polynomials (leading term has coefficient 1). Hence, the error reduces at $n$ increases, but of course it is more expensive to use a larger $n$.

2) Shifting a function with a constant is equivalent to shifting the interval of integration. Gaussian quadrature is usually performed on the interval $[-1,1]$, however transforming from the general interval $[a,b]$ can be done as follows: $$ \int_a^b f(x) \text{d}x = \frac{b-a}{2} \int_{-1}^1 f \left( \frac{b-a}{2}x + \frac{b+a}{2} \right) \text{d}x \approx \frac{b-a}{2} \sum_{i=1}^n w_i f \left( \frac{b-a}{2}x_i + \frac{b+a}{2} \right). $$ In other words: Yes, Gaussian quadrature works if constants are involved. However, of course the original function must be well defined and appropriately integrable in the domain of interest.

In your particular case of Gauss-Hermite quadrature the integral of the function $f(x+c)$ would be approximated by $$ \int_{-\infty}^\infty f(x+c) \text{d}x \approx \sum_{i=1}^n w_i f(x_i + c). $$ With $f(x) = \ln{(x)}$, this integral is not very pleasant and I doubt you would get a sensible result from the quadrature, but constant shifts for "well behaved" functions should not be a problem.