#11590: Integrating the sgn() function can produce incorrect results
------------------------+---------------------------------------------------
Reporter: mjo | Owner: burcin
Type: defect | Status: new
Priority: major | Milestone:
Component: calculus | Keywords:
Work_issues: | Upstream: Reported upstream. Developers
acknowledge bug.
Reviewer: | Author:
Merged: | Dependencies:
------------------------+---------------------------------------------------
Comment(by nbruin):
Some random observations that may or may not be relevant. First, let's
separate the "Reader" (parser) and the "Evaluator".
{{{
sage: from sage.libs.ecl import *
sage:
I1=EclObject("#$integrate(x*signum(x^2-1/4),x,-1,0);$").cadr().cdr().car()
sage:
I2=EclObject("#$'integrate(x*signum(x^2-1/4),x,-1,0);$").cadr().cdr().car()
sage: I1
<ECL: (($INTEGRATE)
((MTIMES) $X
((%SIGNUM) ((MPLUS) ((MEXPT) $X 2) ((MMINUS) ((MQUOTIENT) 1 4)))))
$X ((MMINUS) 1) 0)>
sage: I2
<ECL: ((%INTEGRATE)
((MTIMES) $X
((%SIGNUM) ((MPLUS) ((MEXPT) $X 2) ((MMINUS) ((MQUOTIENT) 1 4)))))
$X ((MMINUS) 1) 0)>
}}}
Note the subtle difference between `$INTEGRATE` (function) `%INTEGRATE`
(inert integral form). Sage's `sr_integral` produces the `$INTEGRATE`
expression, so the two alternatives tested are *not* equivalent. I suspect
those trigger different code-paths. You could try changing
{{{
interfaces/maxima_lib.py:205:max_integrate=EclObject("$INTEGRATE")
}}}
to `max_integrate=EclObject("%INTEGRATE")` instead and see if that solves
more than it messes up.
Slightly less likely to make a difference: If you look at the full
expression resulting for `EclObject("#$1+2$")`, you'll notice an `MEVAL*`,
whereas maxima_eval is defined with `MEVAL`. I've never worked out which
one is the proper one to use. So, you should test all combinations (these
skip setting up the proper maxima-error-catching environment):
{{{
sage: EclObject(["meval*",["quote", I1]]).eval()
sage: EclObject(["meval*",["quote", I2]]).eval()
sage: EclObject(["meval",["quote", I1]]).eval()
sage: EclObject(["meval",["quote", I2]]).eval()
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11590#comment:8>
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.