I want to calculate $\int_R^1 \sqrt{r} |\cos((k+\frac{1}{2})\pi r)|dr $ and I get a result from Mathematica. Then I try to check the result putting the value of $k$ and $R$, (k=1 and R=0.5) in the result and performing a NIntegrate with the same value and the result is different. In the analytical result if you put $k=10$ and $R=0.5$ the result is negative and of course wrong, but if I use Nintegrate the result is posivite. What happened? I am interested in the following function of $R$ and $k$.
$$\text{Assuming}\left[R>0\textrm{&&}k>1\textrm{&&}R<1\textrm{&&}k\in\textrm{Integers},\int_0^R \sqrt{r} \textrm{Abs}\left[\cos\left(k+\frac{1}{2}\right)\pi r\right] dr\right]$$ and Mathematica gives the answer $$\frac{2 S\left(\sqrt{2 k R+R}\right) \sec \left(\pi k R+\frac{\pi R}{2}\right)-2 \sqrt{2 k R+R} \tan \left(\pi k R+\frac{\pi R}{2}\right)}{\pi (2 k+1)^{3/2} \sqrt{\sec ^2\left(\pi k R+\frac{\pi R}{2}\right)}}$$
and if you evaluate this function in $R=0.2$ and $k=1$ the result is $-0.0488018$. This result is different from the definite integral with the same value for the parameters. Thank you in advance again
{}
above the edit window. Save edit. Do not try to convert it to TeX. $\endgroup$