5

Given the abscissae and weights for 7-point Gauss rule with a 15-point Kronrod rule (Wikipedia); Can anyone provide me a working example how to numerically integrate a function given below:

$$\int_0^1 x^{-1/2}\log(x) \textrm{d}x = -4 $$

Provided abscissae and weights for 6-point Guass rule, I know how I can find the integral, but I don't find any working example for using Gauss Kronrod. I find is relatively easy to understand how Gauss Kronrod work if I have a working example. It would be great if someone can suggest some good literature on Gauss Kronrod method (not how to calculate abscissae and weights, there are so many papers about them I have already seen) but about its working.

Gauss quadrature rule looks like this:

$$ \int_{-1}^{1} f(x) \textrm{d}x = \sum_{i=0}^n c_i f(x_i)$$

To convert the limits to what is required by this rule: $$ \int_{a}^{b} f(x) \textrm{d}x = \frac{b-a}{2}\int_{-1}^{1} f(x \cdot \frac{b-a}{2} + \frac{b+a}{2}) \textrm{d}x $$

Effectively this transformation to the function above can be seen as:

$$\int_a^b x^{-1/2}\log(x) \textrm{d}x= \frac{b-a}{2}\int_{-1}^1 (x \cdot \frac{b-a}{2} + \frac{b+a}{2})^{-1/2} \cdot \log(x \cdot \frac{b-a}{2} + \frac{b+a}{2}) \textrm{d}x $$

Thus we can replace the integral part with the summation part, replace the weights and abscissae and we are done.

Can someone kindly provide me the similar transformation for Guass Kronrod? I believe we only need the weights used in gauss quadrature rule; plus we have to use the kronrod weights and abscissae. But how is the equation looking like, I don't know.

fahad
  • 53
  • Make the change of variable $x=\frac{u+1}{2}$, and apply the precomputed weights, evaluation points. I would expect quite bad performance, because though the improper integral exists, the function blows up. – André Nicolas Jul 12 '13 at 15:25
  • Performance with respect to Gauss rule but accuracy (as far as my limited knowledge about kronrod) increases. Isn't that correct? – fahad Jul 12 '13 at 15:43
  • I think so. The point I was making is that although for testing it is useful to have an integral we can compute explicitly, like this one, no standard numerical procedure will work well here because of the singularity. – André Nicolas Jul 12 '13 at 15:52
  • @Nicolas Thanks for your help. I added some more information about what I am looking for. (Consider me a dumb calculus guy) If I can get the transformation as I placed in my question. Would be great help. – fahad Jul 12 '13 at 16:22

1 Answers1

5

You have quoted the right transformation, since the Gauss-Kronrod also is for the interval $[-1,1]$. To shift the integral to $[-1,1]$ we make the substitution $u=2x-1$. Then $dx=\frac{1}{2}\,du$, and $x^{-1/2}=\left(\frac{u+1}{2}\right)^{-1/2}$, and $\log x=\log(\frac{u+1}{2})$. In this case, there would be good reason to perform some additional algebraic manipulation, but there is no need to. Our integral is equal to $$\int_{u=-1}^1 \frac{1}{2}\left(\frac{u+1}{2}\right)^{-1/2}\log\left(\frac{u+1}{2}\right)\,du.$$ Call the function we are integrating $f(u)$. Use published Kronrod nodes $u_i$ and weights $w_i$ and find $\sum w_if(u_i)$.

Remark: Because of the singularity of our original function at $0$, one would expect very poor numerical performance. Even in a much better behaved integral like $\int_0^1 \sqrt{x}\cos x\,dx$, the fact that the derivative blows up near $0$ means that we need to use special techniques. Your function's behaviour near $0$ is much worse than that.

André Nicolas
  • 507,029