Trapezoidal rule to find $\int_{0}^{1} \frac {\cos(2x)}{x^{1/3}} dx$

I am supposed to find the integration of the given function in the interval $[0,1]$ using trapezoidal rule (as an assignment problem). $$\frac {\cos(2x)}{x^\frac{1}{3}}$$

As it can be seen, the value of the function is not defined at $x=0$ and hence, it seems impossible to find the solution using trapezoidal rule.

Am I thinking the right way, or there exists some method to find the solution?

The behavior of the singularity at the origin is like $\dfrac1{x^{1/3}}$. It is advisable to remove it and integrate it separately:

$$\int_0^1\frac {\cos(2x)}{x^{1/3}}dx=\int_0^1\frac{\cos(2x)-1}{x^{1/3}}dx+\int_0^1\frac{dx}{x^{1/3}}=-2\int_0^1\frac{\sin^2(x)}{x^{1/3}}dx+\frac32x^{2/3}\Big|_0^1.$$

Unfortunately, this form is still unsuitable for trapezoidal interpolation, as the second derivative has a $x^{-1/3}$ factor, making the remainder potentially large (magenta curve).

Alternatively, use the change of variable $x=t^\alpha$, to turn the integral to

$$\alpha\int_0^1\cos(2t^\alpha) t^{\alpha-1-\alpha/3}\,dt.$$

You have the option to choose $\alpha=\frac32$ to get rid of the power factor completely

$$\frac32\int_0^1\cos(2t^{3/2})\,dt,$$ or $\alpha=3$ to avoid fractional exponents $$2\int_0^1\cos(2t^3)t\,dt.$$

In both cases, the second derivative is well-behaved. You should prefer $\alpha=\frac32$ (blue curve).

• I think that the same explanation has been provided by @Jack. If there is anything that I might be overlooking, please do mention it. – Gaurav Feb 24 '15 at 1:35
• Yes, they were the same, explained differently. After deeper thinking, I realized that this approach is unsuitable for the trapezoidal rule and found better solutions. – Yves Daoust Feb 24 '15 at 8:27
• Great !! This is completely out of the box idea. – Gaurav Feb 24 '15 at 8:36
• Yep, remainder analysis shouldn't be forgotten. – Yves Daoust Feb 24 '15 at 8:43
• @YvesDaoust, +1 very clever. – k170 Feb 24 '15 at 11:05

You can exploit the fact that

$$\int_{0}^{1}\frac{1}{x^{1/3}}\,dx = \frac{3}{2}$$ hence your integral equals:

$$\frac{3}{2}-\int_{0}^{1}\frac{1-\cos(2x)}{x^{1/3}}\,dx = \frac{3}{2}-2\int_{0}^{1}\frac{\sin^2 x}{x^{1/3}}\,dx$$ and all the unboundness-issues are gone, since: $$\lim_{x\to 0^+}\frac{\sin^2 x}{x^{1/3}} = 0.$$

The original integral also equals a series. Since: $$\cos(2x) = \sum_{n\geq 0}\frac{(-1)^n 4^n}{(2n)!} x^{2n}$$ it follows that: $$\int_{0}^{1}\cos(2x)\, x^{-1/3}\,dx = \sum_{n\geq 0}\frac{(-1)^n 4^n}{(2n)!}\cdot\frac{3}{6n+2}=\frac{3}{2}\phantom{}_1 F_2\left(\frac{1}{3};\frac{1}{2},\frac{4}{3};-1\right)=0.88023061769\ldots.$$

• Sorry, I am not familiar with the complex notation. Could you please tell me what the expression $\frac{3}{2}\phantom{}_1 F_2\left(\frac{1}{3};\frac{1}{2},\frac{4}{3};-1\right)$ means? – Gaurav Feb 23 '15 at 14:48
• – Jack D'Aurizio Feb 23 '15 at 14:49
• May I dare to ask the reason for the downvote? My answer is essentially the same as Yves Daoust's, just with some detail more on the numerical computation of the integral. – Jack D'Aurizio Feb 24 '15 at 0:11

First let's rewrite it as $$\lim\limits_{a\to 0^+}\int_a^1\frac {\cos(2x)}{x^\frac{1}{3}} dx$$ Now let's use integration by parts $$u=\cos(2x)$$ $$du=-2\sin(2x)dx$$ $$dv=\frac{1}{x^{\frac13}}dx$$ $$v=\frac32 x^{\frac23}$$ So now we have $$\frac32\lim\limits_{a\to 0^+} \left[x^{\frac23} \cos(2x)\bigg|_a^1+2\int_a^1 x^{\frac23}\sin(2x)dx\right]$$ $$=\frac32\lim\limits_{a\to 0^+} \left[\cos(2)- a^{\frac23} \cos(2a)\right] +3 \lim\limits_{a\to 0^+} \int_a^1 x^{\frac23}\sin(2x)dx$$ $$=\frac32\cos(2)-\frac32\lim\limits_{a\to 0^+} \left[ a^{\frac23} \cos(2a)\right] +3 \lim\limits_{a\to 0^+} \int_a^1 x^{\frac23}\sin(2x)dx$$ $$=\frac32\cos(2)-0+3 \lim\limits_{a\to 0^+} \int_a^1 x^{\frac23}\sin(2x)dx$$ $$=\frac32\cos(2)+3 \lim\limits_{a\to 0^+} \int_a^1 x^{\frac23}\sin(2x)dx$$ Now you can use the trapezoidal rule on the remaining integral. I'll leave that to you.

• I'm finding it for 2 intervals. $h=\frac{1-a}{2}$ and the whole expression simplifies to : $\frac{1-a}{4} [\frac{cos(2a)}{a^\frac{1}{3}}+cos(2)]+\frac{1-a}{2^\frac{2}{3}}[\frac{cos(1+a)}{(1+a)^\frac{1}{3}}]$. I'm stuck from where I began because on taking limit for $a\rightarrow 0$, it still results in division by zero. Could you please help me out to simplify it further. – Gaurav Feb 23 '15 at 14:42