Difference between integral(csc(x)) and integral(1/sin(x))?

integral(csc(x),x) gives -log(cot(x) + csc(x)) as expected. integral(1/sin(x),x) gives -1/2log(cos(x) + 1) + 1/2log(cos(x) - 1). Evaluation of the second log is problematic because cos(x)-1 < 0 for all x except n*2pi. Choosing the sympy or maxima algorithms makes no difference.

Also (and this is less reliable) if I perform a substitution t=tan(x/2) by hand in the first case I get ln(t), again as expected. But in the second ln(-t). That maybe my fault but I can't see what I did wrong.

Is there any fundamental difference between asking that same question in two different ways?

edit retag close merge delete

Sort by » oldest newest most voted

The two integrals differ by a constant,

sage: log(-1)
I*pi

and integration is defined only up to a constant. So there is no problem, seen from this point of view. From the point of view of a Mathematical Olympiad -say - there is some problem, since at that level there is no $\log(-1)$, and such a calculus my get negative points, if things are not explained in full detail. As a rule of thumb for such particular cases, one can replace all terms $\log(\ f(x)\ )$ by the corresponding $\log|\ f(x)\ |$ so tht the computations "remain in the school". In our case, "adding the modulus" changes the sign inside the $\log$ of $\cos x-1$ to get $\log(1-\cos x)$. In our case we can then ask sage for

sage: bool( (cot(x)+csc(x))^2 == (1+cos(x)) / (1-cos(x)) )
True

or even better check it with bare hands by the substitution $t=\tan(x/2)$ s in the post.

more

And that also exactly explains the change of sign in my rough working of the second form producing ln(-t). Thanks for the quickly supplied and thorough answer.