4
$\begingroup$

This is my homework question: Calculate $\int_{0}^{1}x^2\ln(x) dx$ using Simpson's formula. Maximum error should be $1/2\times10^{-4}$

For solving the problem, I need to calculate fourth derivative of $x^2\ln(x)$. It is $-2/x^2$ and it's maximum value will be $\infty$ between $(0,1)$ and I can't calculate $h$ in the following error formula for using in Simpson's formula.

$-\frac{(b-a)}{180}h^4f^{(4)}(\eta)$

How can I solve it?

  • 0
    @CameronBuie: True, and in that case you don't get "improperness" from having unbounded functions, although sometimes you do from unbounded domains. (Standard example: $\int_0^\infty\frac{\sin(x)}{x}$ doesn't exist according to the usual Lebesgue definition, although it can be defined in the "improper" way usually applied to Riemann integration, because $\lim_{b\to\infty}\int_0^b\frac{\sin(x)}{x}$ exists.)2012-05-18

2 Answers 2

5

I will expand on copper.hat's comment. Let $f(x)=x^2\ln(x)$ on $(0,1]$, and $f(0)=0$. Note that $f$ is continuous on $[0,1]$. The first derivative of $f$ is $f'(x)=x+2x\ln(x)$. The only critical point in $(0,1)$ is at $x=1/\sqrt{e}$, and $f$ is decreasing on the interval $[0,1/\sqrt{e}]$. Therefore if $0, then $cf(c)<\int_0^cf(x)dx<0$. You can choose $c$ such that $|cf(c)|<\frac{1}{4}\times 10^{-4}$. This leaves the estimate of the integral $\int_c^1f(x)dx$, and on the interval $[c,1]$ you have $|f^{(4)}(x)|\leq |f^{(4)}(c)|=\frac{2}{c^2}$, so to choose your $h$ you can solve the inequality $\frac{(1-c)}{90c^2}h^4<\frac{1}{4}\times 10^{-4}$.

For example, $c=0.01$, $h=0.01$ would work. Simpson's rule can then be applied on the entire interval with $h=0.01$, because the error on each of $[0,0.01]$ and $[0.01,1]$ will be less than $\frac{1}{4}\times 10^{-4}$, meaning that the total error will be less than $\frac{1}{2}\times 10^{-4}$ (in absolute value).

2

As already noticed, $f(x)$ is not $C^4$ on the closed interval $[0,1]$, and a direct estimate on the error in Simpson's method is troublesome. One way to handle things is to remove the left end point as described by Jonas Meyer. Another way to handle weak singularities as these is to start with a change of variables.

For this particular integral, you can check that the substitution $x = t^a$ for $a$ large enough will turn the integrand into a $C^4$ function. For example, $a = 2$ gives $x = t^2$, $dx = 2t\,dt$, so

$\int_0^1 x^2 \ln(x)\,dx = \int_0^1 t^4 \ln(t^2)\,2t\,dt= 4\int_0^1 t^5\ln(t)\,dt.$

Let $g(t) = t^5\ln(t)$. You can check that $g(t)$ is $C^4$ on $[0,1]$. (Extended to $g(0) = 0$, of course.) Furthermore $|g^{(4)}(t)| \le 154$ on $[0,1]$. Simpson's rule on $g$ now works (reasonably) well.