Skip to content

Commit

Permalink
Trac #17468: Strange integration error/hang with log(abs(sin(x)))
Browse files Browse the repository at this point in the history
Here is something that hangs.
{{{
sage: var('u')
u
sage: integral(log(abs(2*sin(u))), u, 0, pi/3)
}}}
Interestingly, we get
{{{
sage: maxima_calculus('integrate(log(abs(2*sin(u))), u, 0, %pi/3)')
#0: extra_integrate(q=(g93030^2+1)*(4*g93030/((g93030^2+1)*abs(g93030))-
8*g93030*abs(g93030)/(g93030^2+1)^2)/abs(g93030),x=g93030)
------------------------------------------------------------------------
---
TypeError
}}}
but in the shell, we get
{{{
(%i1) integrate(log(abs(2*sin(u))),u,0,%pi/3);
                 sqrt(3) %i + 1                sqrt(3) %i + 1
(%o1) (18 %i li (--------------) + 18 %i li (- --------------) - 3 %pi
log(3)
               2       2                   2         2
      2
                                                   2       %pi log(3)
%i %pi
                                         + 2 %i %pi )/18 + ---------- -
-------
                                                               6
12
}}}

The problem in Sage directly is
{{{

(%i1) load(abs_integrate);
(%o1) /Users/karl.crisman/Downloads/sage/local/share/maxima/5.34.1/share
/contr\
ib/integration/abs_integrate.mac
(%i2) integrate(log(abs(2*sin(u))),u,0,%pi/3);

log: encountered log(0).
}}}
after which it hangs, and I'll report that upstream.  But I don't know
what the error in `maxima_calculus` is!

URL: https://trac.sagemath.org/17468
Reported by: kcrisman
Ticket author(s): Frédéric Chapoton
Reviewer(s): Peter Bruin
  • Loading branch information
Release Manager committed Oct 10, 2019
2 parents 77423c7 + d1b9085 commit 8d0a41b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sage/symbolic/integration/integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,13 @@ def integrate(expression, v=None, a=None, b=None, algorithm=None, hold=False):
sage: integrate(abs(x^2 - 1), x, -2, 2)
4
Some tests for :trac:`17468`::
sage: integral(log(abs(2*sin(x))), x, 0, pi/3)
1/36*I*pi^2 + I*dilog(1/2*I*sqrt(3) + 1/2) + I*dilog(-1/2*I*sqrt(3) - 1/2)
sage: integral(log(abs(sin(x))), x, 0, pi/2)
-1/2*pi*log(2)
Check that :trac:`25823` is fixed::
sage: f = log(sin(x))*sin(x)^2
Expand Down

0 comments on commit 8d0a41b

Please sign in to comment.