Do you guys have any idea how to handle something like
$\int_0^1 log(x) dx$ numerically in Matlab (I'm only interested in the real part btw)?
I have used Quad, Quadl, "integral" etc all of them find intfy at the origin.
I have tried to change the lower limit to, say 0.00001, and then the result is finite, but 0.00001 is really not good enough and if I use something smaller than 0.00001 the result again is infty.
I should add that the integrand is not a simple log(x) but rather long expression which goes like/(Taylor expansion) log(x) near x=0. I have defined this integrand in a separate function file.
Now $\lim_{x->0} J(x) = -\infty$ where $J$ is the integrand, BUT the integral should be finite at x=0.
Any ideas what to do?
Thanks.
Probably easiest is to use the closed form result $\int_0^1 \log(x) \mathrm{d}x = -\int_0^\infty t \mathrm{e}^{-t} \mathrm{d}t = -1$, and apply quadratures to $J(x)-\log(x)$: $$ \int_0^1 J(x) \mathrm{d}x = -1 +\int_0^1 \left(J(x)-\log(x)\right)\mathrm{d}x $$