#17892: Sage cannot work with Maxima's symbolic limit
----------------------------+------------------------
Reporter: rws | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.6
Component: calculus | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
----------------------------+------------------------
Old description:
> Maxima gives back limit expressions in some integral computation but Sage
> has no idea what that is. Consequently, working with the expression leads
> to failure:
> {{{
> sage: u(t) = exp(-(t-a)^2/(2*s^2)) + exp(-(t-b)^2/(2*s^2)) ; u(t);
> sage: integral(u(t)*exp(-I*k*t), t, -infinity, +infinity, hold=False)
> -limit(1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*a +
> sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*a*k) +
> 1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*b +
> sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*b*k), t, -Infinity, plus) +
> limit(1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*a +
> sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*a*k) +
> 1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*b +
> sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*b*k), t, +Infinity, minus)
> sage: _.simplify_full()
> ...
> TypeError: ECL says: Error executing code in Maxima:
> }}}
> Presumably a symbolic limit function would be necessary, and to connect
> it with what Maxima gives back.
>
> Is there a smaller example?
>
> This is from http://ask.sagemath.org/question/26004/sage-65-maxima-
> simplify_full-error/
New description:
Maxima gives back limit expressions in some integral computation but Sage
has no idea what that is. Consequently, working with the expression leads
to failure:
{{{
sage: var('a,b,t,s,k');
sage: u(t) = exp(-(t-a)^2/(2*s^2)) + exp(-(t-b)^2/(2*s^2)) ;
sage: I=integral(u(t)*exp(-I*k*t), t, -infinity, +infinity); I
-limit(1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*a +
sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*a*k) +
1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*b +
sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*b*k), t, -Infinity, plus) +
limit(1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*a +
sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*a*k) +
1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*b +
sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*b*k), t, +Infinity, minus)
sage: I.simplify_full()
...
TypeError: ECL says: Error executing code in Maxima:
}}}
Presumably a symbolic limit function would be necessary, and to connect it
with what Maxima gives back.
Is there a smaller example?
This is from http://ask.sagemath.org/question/26004/sage-65-maxima-
simplify_full-error/
--
Comment (by nbruin):
Funnily enough it's not the limit placeholder that seems to be the primary
issue. For the most part, the generic stuff just works for that. It's the
"plus" or "minus" keyword that confuses things.
{{{
sage: L=I.operands()[0].operands()[0]
limit(1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*a +
sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*a*k) +
1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*b +
sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*b*k), t, -Infinity, plus)
sage: Ls=L.operator()(*L.operands()[:-1]); Ls
limit(1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*a +
sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*a*k) +
1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*b +
sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*b*k), t, -Infinity)
sage: Ls.simplify_full()
1/2*sqrt(pi)*e^(-1/2*k^2*s^2 - I*a*k -
I*b*k)*limit(sqrt(2)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*b +
sqrt(2)*t)/s)*e^(I*a*k) + sqrt(2)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*a +
sqrt(2)*t)/s)*e^(I*b*k), t, -Infinity)
}}}
i.e., the direct problem is that the keyword "plus" does not get
translated appropriately. In fact:
{{{
sage: L.operands()[-1].is_symbol()
True
sage: L.operands()[-1]._maxima_()
_SAGE_VAR_plus
}}}
as you can see, the maxima symbol "plus" got translated to a symbolic
variable, which doesn't round-trip properly. It would have been nice to
recognize "plus" on the maxima side not into a variable.
For the rest:
{{{
sage: limit(L.operands()[0],t=-oo,dir='+')
limit(1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*a +
sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*a*k) +
1/2*sqrt(2)*sqrt(pi)*s*erf(1/2*(I*sqrt(2)*k*s^2 - sqrt(2)*b +
sqrt(2)*t)/s)*e^(-1/2*k^2*s^2 - I*b*k), t, -Infinity, plus)
}}}
which gives a bit of a pointer to the sage user interface (we shouldn't
use that as "placeholder", though: it punts to maxima by default, so it
shouldn't be called for interpreting the result that comes back).
--
Ticket URL: <http://trac.sagemath.org/ticket/17892#comment:2>
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.