Opened 7 years ago
Last modified 5 years ago
#13071 new defect
maxima interface integration problem
Reported by: | dsm | Owned by: | burcin |
---|---|---|---|
Priority: | major | Milestone: | sage-6.4 |
Component: | symbolics | Keywords: | |
Cc: | kcrisman | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Something seems to be going wrong in maxima_lib:
sage: integrate(sin(x), x) -cos(x) sage: integrate(sin(x)*exp(x), x) 1/2*(sin(x) - cos(x))*e^x sage: integrate(sin(x)*exp(x)/x, x) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (580, 0)) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/mcneil/sagedev/sage-5.1.beta1/devel/sage-hack/sage/<ipython console> in <module>() /home/mcneil/sagedev/sage-5.0/local/lib/python2.7/site-packages/sage/misc/functional.pyc in integral(x, *args, **kwds) 726 """ 727 if hasattr(x, 'integral'): --> 728 return x.integral(*args, **kwds) 729 else: 730 from sage.symbolic.ring import SR /home/mcneil/sagedev/sage-5.0/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.integral (sage/symbolic/expression.cpp:33707)() [...] /home/mcneil/sagedev/sage-5.0/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.pyc in max_to_sr(expr) 1536 op=max_op_dict[op_max] 1537 max_args=cdr(expr) -> 1538 args=[max_to_sr(a) for a in max_args] 1539 return op(*args) 1540 elif expr.symbolp(): /home/mcneil/sagedev/sage-5.0/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.pyc in max_to_sr(expr) 1537 max_args=cdr(expr) 1538 args=[max_to_sr(a) for a in max_args] -> 1539 return op(*args) 1540 elif expr.symbolp(): 1541 if not(expr in max_sym_dict): TypeError: op_mul expected 2 arguments, got 1
This happens in 5.0 and beyond. Unfortunately I don't have a 4.8 at hand so I can't track it down before that.
Strangely enough, if you do it again, you get a different error:
/home/mcneil/sagedev/sage-5.0/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.pyc in sr_integral(self, *args) 745 raise ValueError, "Computation failed since Maxima requested additional constraints; using the 'assume' command before integral evaluation *may* help (example of legal syntax is 'assume(" + s[4:k] +">0)', see `assume?` for more details)\n" + s 746 else: --> 747 raise error 748 749 def sr_sum(self,*args): RuntimeError: ECL says: Error executing code in Maxima: conjugate: wrong number of arguments.
So -- and this might be independent -- something's stateful which probably shouldn't be.
Change History (5)
comment:1 Changed 7 years ago by
comment:2 Changed 6 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:3 Changed 5 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:4 Changed 5 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:5 Changed 5 years ago by
- Milestone changed from sage-6.3 to sage-6.4
Note: See
TracTickets for help on using
tickets.
Yep, sage is trying to learn how to translate "conjugate" and gets tripped up. The following does work because it primes the dictionary.
The problem is that sage tries to learn what conjugate is from this expression:
but its conversion to SR pulls out a minus sign:
so in max_to_sr line 1530 text-based fallback we find that the corresponding operator is:
Once conversion of multiplication is broken, we of course get all kinds garbage. A warning for exactly this problem is in the source.
Work-around for this particular issue: Prepopulate sage_op_dict with conjugate
A better solution would be to once and for all solve this problem by initializing sage_op_dict from the same source where the text-based interface gets its knowledge from.