#12731: Disable abs_integrate
-------------------------------------+-------------------------------------
Reporter: roed | Owner: burcin
Type: defect | Status: needs_review
Priority: critical | Milestone: sage-6.8
Component: calculus | Resolution:
Keywords: | Merged in:
Authors: Ralf Stephan | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/rws/disable_abs_integrate | 1993a28f9ea2dec2cfb255fddee6f01939f69372
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by kcrisman):
Replying to [comment:26 kcrisman]:
> > > If we set this variable to the empty list, then no additional
integrations will be attempted by Maxima (by default). But, we can still
try them ourselves. So we could,
> > >
> > > 1. Try the standard Maxima `integrate`, and save the result.
> > > 2. Try `signum_int`, and see if the result matches the first one. If
it does, ignore it. Otherwise, emit a warning and return the answer.
> > > 3. Try `abs_integrate_use_if`, and see if the result matches the
first one. If it does, ignore it. Otherwise, emit a warning and return the
answer.
It won't, because it will always return something like this:
{{{
sage: integrate(1/(1 + abs(x+1) + abs(x-1)),x)
TypeError: unable to make sense of Maxima expression
'if(-(_SAGE_VAR_x+1)>0,-log(1-2*_SAGE_VAR_x)/2+log(3)-2/3,if(-(_SAGE_VAR_x-1)>0,_SAGE_VAR_x/3+log(3)/2-1/3,log(2*_SAGE_VAR_x+1)/2))'
in Sage
}}}
> > I think it is better to simply NOT try the suspect integration methods
upon a normal integral invocation and only resort to them when a special
command/flag is given, e.g.:
> > {{{
> > sage: integrate(abs(sin(x)),x,0,pi)
> > integrate(abs(sin(x)), x, 0, pi)
> > sage: integrate(abs(sin(x)),x,0,pi, algorithm="spaced_out_maxima")
> > 0
> > }}}
> > or whatever access method we want to use (and whatever result we get
from that).
>
> +1
I would be in favor of this, and would give positive review to changes
disabling by default but allowing this. I think it would be pretty easy
to implement, in fact.
* Keep `abs_integrate` loading initially in `maxima_lib.py`.
* Immediately set the two `methods` to `[]`, perhaps right with
`init_code.append('nolabels : true')` a few lines later.
* Then add an integrator in `src/sage/symbolic/integration/external.py`,
something like
{{{
def maxima_absint_integrator(expression, v, a=None, b=None):
from sage.calculus.calculus import maxima
maxima.eval("extra_definite_integration_methods=['abs_defint]")
maxima.eval("extra_integration_methods=['signum_int]") # NOT using the
if variant
if not isinstance(expression, Expression):
expression = SR(expression)
if a is None:
result = maxima.sr_integral(expression,v)
else:
result = maxima.sr_integral(expression, v, a, b)
maxima.eval("extra_definite_integration_methods=[]")
maxima.eval("extra_integration_methods=[]") # NOT using the if variant
return result._sage_()
}}}
* Then in `src/sage/symbolic/integration/integral.py` just add
{{{
import sage.symbolic.integration.external as external
available_integrators['maxima'] = external.maxima_integrator
available_integrators['maxima_absint'] = external.maxima_absint_integrator
available_integrators['sympy'] = external.sympy_integrator
available_integrators['mathematica_free'] = external.mma_free_integrator
available_integrators['fricas'] = external.fricas_integrator
}}}
and port doctests, with a humongous warning not to use this unless you
are willing to check answers numerically or something.
That could, in principle, be a separate ticket, but I would want them to
depend upon each other. Also, that wouldn't remove the necessity of
#17910.
By the way, it's interesting that
http://sourceforge.net/p/maxima/bugs/2242/#8ddc suggests that adding
`'integrate` to the methods lists could actually do at least some of these
integrals...
--
Ticket URL: <http://trac.sagemath.org/ticket/12731#comment:33>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.