Rewrite an integral and compute a Riemann sum numerically

127 Views Asked by At

I have the following integral: $$I=\int^{\pi/4}_{0}\cos(x)\ln(x)dx$$ And I want to rewrite it in the following form: $I=a-J$, where $J=\int^{\pi/4}_{0}h(x)dx$.

$a \in R$ is a constant the function $h(x)$ is continuous and bounded around zero. I want to find $a$ and $h(x)$.

Now when I have $I$, I want to compute $I$ numerically (in R-studio) by applying the Riemann rule to $J$, by using 100 nodes for the computation of $J$.

I'm not sure how to start, any help is greatly appreciated :)

1

There are 1 best solutions below

2
On BEST ANSWER

Looks like you have what you need already, so I'll post an answer for completeness sake. Credits to Daniel Fischer

$$ \int_0^{\pi/4} \cos x \ln x\ dx = \int_0^{\pi/4} \left(1-2\sin^2 \frac{x}{2}\right)\ln x \ dx = \frac{\pi}{4}\left(\ln \frac{\pi}{4} - 1\right) - \int_0^{\pi/4}2\sin^2 \frac{x}{2}\ln x\ dx $$

and also $$ \lim_{x\to 0}\ \sin^2 \frac{x}{2}\ln x = 0 $$