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?
 A: 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.$$
A: 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.
A: 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).

