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.Thu, 27 Feb 2020 17:41:06 +0100Is this a known bug with integral()https://ask.sagemath.org/question/30075/is-this-a-known-bug-with-integral/I've tried to compute the following integral wth integral() in a SageMathCloud worksheet: $\displaystyle \int_{-\pi/6}^{\pi/6}\frac{\cos x}{1+\sin x}dx$.
The output was an error message (saying the integral is divergent), just like the one I got in SageMathCell (see link):
https://sagecell.sagemath.org/?z=eJzzVLBVyMwrSU0vSszRSM4v1qjQ1Ncw1C7OzAOyNHUUKnQUdAsy9c10FECkJi9XcUZ-uYanJgDa5Q_i&lang=sage
So I tried with integrate() and with numerical_integral() as well. I was never able to obtain the value of this integral, which turns out to be $\ln(3)$ after an obvious substitution.
Is this a bug?
Note that replacing 1 by 1.1 yields this:
https://sagecell.sagemath.org/?z=eJzzVLBVyMwrSU0vSszRSM4v1qjQ1Ncw1DPULs7MA7I1dRQqdBR0CzL1zXQUQKQmL1dxRn65hqcmAPXGEEE=&lang=sage
while we get that when replacing 1 by 2:
https://sagecell.sagemath.org/?z=eJzzVLBVyMwrSU0vSszRSM4v1qjQ1Ncw0i7OzAOyNHUUKnQUdAsy9c10FECkJi9XcUZ-uYanJgDbCA_j&lang=sageSat, 17 Oct 2015 17:01:02 +0200https://ask.sagemath.org/question/30075/is-this-a-known-bug-with-integral/Answer by FrédéricC for <p>I've tried to compute the following integral wth integral() in a SageMathCloud worksheet: $\displaystyle \int_{-\pi/6}^{\pi/6}\frac{\cos x}{1+\sin x}dx$.</p>
<p>The output was an error message (saying the integral is divergent), just like the one I got in SageMathCell (see link):
<a href="https://sagecell.sagemath.org/?z=eJzzVLBVyMwrSU0vSszRSM4v1qjQ1Ncw1C7OzAOyNHUUKnQUdAsy9c10FECkJi9XcUZ-uYanJgDa5Q_i&lang=sage">https://sagecell.sagemath.org/?z=eJzz...</a></p>
<p>So I tried with integrate() and with numerical_integral() as well. I was never able to obtain the value of this integral, which turns out to be $\ln(3)$ after an obvious substitution.</p>
<p>Is this a bug?</p>
<p>Note that replacing 1 by 1.1 yields this:
<a href="https://sagecell.sagemath.org/?z=eJzzVLBVyMwrSU0vSszRSM4v1qjQ1Ncw1DPULs7MA7I1dRQqdBR0CzL1zXQUQKQmL1dxRn65hqcmAPXGEEE=&lang=sage">https://sagecell.sagemath.org/?z=eJzz...</a></p>
<p>while we get that when replacing 1 by 2:
<a href="https://sagecell.sagemath.org/?z=eJzzVLBVyMwrSU0vSszRSM4v1qjQ1Ncw0i7OzAOyNHUUKnQUdAsy9c10FECkJi9XcUZ-uYanJgDbCA_j&lang=sage">https://sagecell.sagemath.org/?z=eJzz...</a></p>
https://ask.sagemath.org/question/30075/is-this-a-known-bug-with-integral/?answer=30079#post-id-30079Maxima is apparently not able to do that, but sympy can:
sage: integral(cos(x)/(1+sin(x)),(x,-pi/6,pi/6),algorithm='sympy')
log(3)
Sat, 17 Oct 2015 19:46:02 +0200https://ask.sagemath.org/question/30075/is-this-a-known-bug-with-integral/?answer=30079#post-id-30079Comment by Karn3003 for <p>Maxima is apparently not able to do that, but sympy can:</p>
<pre><code>sage: integral(cos(x)/(1+sin(x)),(x,-pi/6,pi/6),algorithm='sympy')
log(3)
</code></pre>
https://ask.sagemath.org/question/30075/is-this-a-known-bug-with-integral/?comment=50090#post-id-50090integral(cos(x)/(1+sin(x)),(x,-pi/6,pi/6),algorithm='sympy')
log(2) + log(3/2)Thu, 27 Feb 2020 17:41:06 +0100https://ask.sagemath.org/question/30075/is-this-a-known-bug-with-integral/?comment=50090#post-id-50090