# mistake in a indefinite integral

Hi,

I'm trying to compute the integral:

integral(log(cot(x)-1),x,0,pi/4)

Sage (with version 5.4 and previous ones) tell that the integral is $-\infty$. But the integral converges, and it is is equal to $\frac{\pi\log(2)}8$.

I think this can be a bug. Maybe it is a Maxima issue, but it should be interesting to find where the bug is, and correct it, if possible.

edit retag close merge delete

Sort by » oldest newest most voted

Using

p(x)=integral(log(cot(x)-1),x)


I see that p(0) is

1/2*I*polylog(2, -1/2*I + 1/2) - 1/2*I*polylog(2, 1/2*I + 1/2)


which is approximated using p(0).n() to give

0.643767332889269


When I ask for limit(p(x),x=pi/4), I get the following error in Sage 5.0:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_12.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("bGltaXQocCh4KSx4PXBpLzQp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>

File "/tmp/tmp607wqe/___code___.py", line 3, in <module>
exec compile(u'limit(p(x),x=pi/_sage_const_4 )
File "", line 1, in <module>

File "/home/sageserver/sage-5.0.1/local/lib/python2.7/site-packages/sage/calculus/calculus.py", line 1163, in limit
l = maxima.sr_limit(ex, v, a)
File "/home/sageserver/sage-5.0.1/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py", line 859, in sr_limit
raise error
RuntimeError: ECL says: Error executing code in Maxima: atan2: atan2(0,0) is undefined.


But, executing atan2(0,0) gives 0. So, something is wrong here somewhere.

more

We changed this more recently. sage: atan2(0,0) now gives RuntimeError: arctan2_eval(): arctan2(0,0) encountered. Which maybe isn't as helpful as it could be...

( 2012-11-20 09:56:20 -0500 )edit

I opened #13733 for this.

( 2012-11-20 10:07:09 -0500 )edit

Thank you!

( 2012-11-23 02:01:29 -0500 )edit

In the most recent Maxima, we have

(%i5) display2d:false;

(%o5) false
(%i6) integrate(log(cot(x)-1),x,0,%pi/4);

Is %pi/8 an ?integer?

n;
Is %pi/4 an ?integer?

n;
Is 2*%pi an ?integer?

n;
(%o6) -(%i*(2*li[2](%i+1)-2*li[2](1-%i))+%pi*log(2))/4
+%i*li[2]((%i+1)/2)/2-%i*li[2](-(%i-1)/2)/2


which I guess is an improvement over

(%i2) integrate(log(cot(x)-1),x,0,%pi/4);

defint: integral is divergent


So a Maxima upgrade should get closer to fixing this, though the polylogs aren't necessarily going to be evaluated by us immediately.

more