ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 27 Jan 2018 18:35:16 +0100Difference between integral(csc(x)) and integral(1/sin(x))?https://ask.sagemath.org/question/40806/difference-between-integralcscx-and-integral1sinx/ integral(csc(x),x) gives -log(cot(x) + csc(x)) as expected. integral(1/sin(x),x) gives -1/2*log(cos(x) + 1) + 1/2*log(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?
Sat, 27 Jan 2018 16:10:05 +0100https://ask.sagemath.org/question/40806/difference-between-integralcscx-and-integral1sinx/Comment by NickBailey for <p>integral(csc(x),x) gives -log(cot(x) + csc(x)) as expected. integral(1/sin(x),x) gives -1/2<em>log(cos(x) + 1) + 1/2</em>log(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.</p>
<p>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.</p>
<p>Is there any fundamental difference between asking that same question in two different ways?</p>
https://ask.sagemath.org/question/40806/difference-between-integralcscx-and-integral1sinx/?comment=40807#post-id-40807SageMath version 8.1, Release Date: 2017-12-07Sat, 27 Jan 2018 16:20:48 +0100https://ask.sagemath.org/question/40806/difference-between-integralcscx-and-integral1sinx/?comment=40807#post-id-40807Answer by dan_fulea for <p>integral(csc(x),x) gives -log(cot(x) + csc(x)) as expected. integral(1/sin(x),x) gives -1/2<em>log(cos(x) + 1) + 1/2</em>log(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.</p>
<p>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.</p>
<p>Is there any fundamental difference between asking that same question in two different ways?</p>
https://ask.sagemath.org/question/40806/difference-between-integralcscx-and-integral1sinx/?answer=40808#post-id-40808The 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.
Sat, 27 Jan 2018 17:57:52 +0100https://ask.sagemath.org/question/40806/difference-between-integralcscx-and-integral1sinx/?answer=40808#post-id-40808Comment by NickBailey for <p>The two integrals differ by a constant,</p>
<pre><code>sage: log(-1)
I*pi
</code></pre>
<p>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 </p>
<pre><code>sage: bool( (cot(x)+csc(x))^2 == (1+cos(x)) / (1-cos(x)) )
True
</code></pre>
<p>or even better check it with bare hands by the substitution $t=\tan(x/2)$ s in the post. </p>
https://ask.sagemath.org/question/40806/difference-between-integralcscx-and-integral1sinx/?comment=40809#post-id-40809And 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.Sat, 27 Jan 2018 18:35:16 +0100https://ask.sagemath.org/question/40806/difference-between-integralcscx-and-integral1sinx/?comment=40809#post-id-40809