#13097: integral of ln(1+4/5*sin(x)) from -3.1415 to 3.1415 crashes Maxima and
Sage
------------------------------------------------------------------+---------
Reporter: kcrisman |
Owner: burcin
Type: defect |
Status: new
Priority: major |
Milestone: sage-5.1
Component: calculus |
Resolution:
Keywords: | Work
issues:
Report Upstream: Reported upstream. Developers acknowledge bug. |
Reviewers:
Authors: | Merged
in:
Dependencies: |
Stopgaps:
------------------------------------------------------------------+---------
Comment (by nbruin):
We can monkey-patch Barton Willis's fix into sage's maxima:
{{{
sage: L="""signum_int(q,x) :=
....: block([w : 1, acc : [], sgn, v, f, listconstvars : true],
....: q : convert_to_signum(q),
....: if freeof('signum, q) then
....: (false)
....: else (
....: q : almost_everywhere_simp(q),
....: v : listofvars(q),
....: q : block([expandwrt_denom : true], expandwrt(q,'signum)),
....: if (f : abs_int_extra(q,x)) # false then f
....: else if (f : partition_as_signum(q,x)) # false then (
....: w : first(f),
....: acc : second(f),
....: if every(lambda([s], linear_in_p(s,x)), acc) then (
....: sgn : xreduce("*", map(lambda([s], diff(s,x)),acc)),
....: acc : map(lambda([s], rhs(first(linsolve(s, x)))),acc),
....: signum_int_helper(signum(sgn) * w, sort(acc), x)))
....: else if (safe_op(q) = "+") then (
....: f : map(lambda([s], signum_int(s,x)), args(q)),
....: if member(false, f) then false else xreduce("+", f))
....: else block([extra_integration_methods : [],
....: extra_definite_integration_methods : []],integrate(q,x))
....: )
....: );"""
sage: integrate(ln(1+4/5*sin(x)), x, -3.1415, 3.1415)
integrate(log(4/5*sin(x) + 1), x, -3.1415, 3.1415)
sage: integrate(ln(sin(x)),x)
1/2*I*x^2 - 1/2*x*log(sin(x)^2 + cos(x)^2 - 2*cos(x) + 1) -
1/2*x*log(sin(x)^2 + cos(x)^2 + 2*cos(x) + 1) + x*log(sin(x)) +
I*x*arctan2(sin(x), -cos(x) + 1) - I*x*arctan2(sin(x), cos(x) + 1) +
I*polylog(2, -e^(I*x)) + I*polylog(2, e^(I*x))
}}}
This just patches a routine defined in `abs_integrate.mac`. It's a *LOT*
slower than in 4.7.1, though, so if performance is any concern, we might
want to reconsider whether abs_integrate should be loaded by default. By
manipulating the maxima variables `extra_integration_methods` and
`extra_definite_integration_methods` it should be possible to control
which integration methods maxima tries to use (this is what
`abs_integrate` hooks into).
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13097#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.