Opened 6 years ago
Last modified 3 years ago
#17892 needs_work defect
Doctest handling of Maxima's one-sided symbolic limits
Reported by: | rws | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.2 |
Component: | calculus | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
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/
Change History (6)
comment:1 Changed 6 years ago by
- Description modified (diff)
comment:2 Changed 6 years ago by
- Description modified (diff)
comment:3 Changed 5 years ago by
Conceivably related: #19203
comment:4 Changed 4 years ago by
- Milestone changed from sage-6.6 to sage-duplicate/invalid/wontfix
- Status changed from new to needs_review
The limit part appears to work now, i.e. the limit is evaluated and gives sqrt(2)*sqrt(pi)*s*e^(-1/2*k^2*s^2 - I*a*k) + sqrt(2)*sqrt(pi)*s*e^(-1/2*k^2*s^2 - I*b*k)
. This means the simplify part is no longer in a code path. I propose to close the original issue. Is there something left?
comment:5 follow-up: ↓ 6 Changed 3 years ago by
- Milestone changed from sage-duplicate/invalid/wontfix to sage-8.2
- Status changed from needs_review to needs_work
- Summary changed from Sage cannot work with Maxima's symbolic limit to Doctest handling of Maxima's one-sided symbolic limits
No, rather this ticket should add an example calling Maxima's integral that is guaranteed to return a one-sided limit.
comment:6 in reply to: ↑ 5 Changed 3 years ago by
Replying to rws:
No, rather this ticket should add an example calling Maxima's integral that is guaranteed to return a one-sided limit.
Also, the interface to Maxima wrt plus/minus is broken with the placeholder function as well:
sage: from sage.functions.other import symbolic_limit as slimit sage: _ = var('plus') sage: slimit(1/x, x, 0, plus) limit(1/x, x, 0, plus) sage: maxima(_) ... TypeError: Error executing code in Maxima CODE: sage4 : limit((_SAGE_VAR_x)^(-1),_SAGE_VAR_x,0,_SAGE_VAR_plus)$ Maxima ERROR: limit: direction must be either 'plus' or 'minus'; found: _SAGE_VAR_plus -- an error. To debug this try: debugmode(true);
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.
i.e., the direct problem is that the keyword "plus" does not get translated appropriately. In fact:
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:
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).