Opened 8 years ago

Last modified 18 months ago

#16335 new defect

wildcards are not converted to Maxima

Reported by: Daniel Krenn Owned by:
Priority: major Milestone: sage-6.4
Component: symbolics Keywords: dictionary, symbolic function, Maxima
Cc: Robert Bradshaw, Nils Bruin, Jean-Pierre Flori Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


The following gives an error:

sage:     D = {}
sage:     f = function('f')
sage:     for dq in srange(0,2):
....:             for du in srange(0,3):
....:                         print dq, du
....:                         D[f(SR.wild(42), dq, du)] = f(SR.wild(42), dq, du)
0 0
0 1
0 2
1 0
TypeError                                 Traceback (most recent call last)
<ipython-input-3-b53f1d26cbca> in <module>()
      2         for du in srange(Integer(0),Integer(3)):
      3                     print dq, du
----> 4                     D[f(SR.wild(Integer(42)), dq, du)] = f(SR.wild(Integer(42)), dq, du)

/usr/opt/Sage-6.2-amd64/local/lib/python2.7/site-packages/sage/symbolic/ in sage.symbolic.expression.Expression.__nonzero__ (sage/symbolic/expression.cpp:12491)()

/usr/opt/Sage-6.2-amd64/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in test_relation_maxima(relation)
    395         sage: forget()
    396     """
--> 397     m = relation._maxima_()
    399     #Handle some basic cases first

/usr/opt/Sage-6.2-amd64/local/lib/python2.7/site-packages/sage/symbolic/ in sage.symbolic.expression.Expression._maxima_ (sage/symbolic/expression.cpp:5294)()

/usr/opt/Sage-6.2-amd64/local/lib/python2.7/site-packages/sage/structure/ in sage.structure.sage_object.SageObject._interface_ (sage/structure/sage_object.c:4596)()

/usr/opt/Sage-6.2-amd64/local/lib/python2.7/site-packages/sage/misc/ in sage.misc.lazy_import.LazyImport.__call__ (sage/misc/lazy_import.c:3000)()

/usr/opt/Sage-6.2-amd64/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in __call__(self, x, name)
    198         if isinstance(x, basestring):
--> 199             return cls(self, x, name=name)
    200         try:
    201             return self._coerce_from_special_method(x)

/usr/opt/Sage-6.2-amd64/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in __init__(self, parent, value, is_name, name)
    624                 self._name = parent._create(value, name=name)
    625             except (TypeError, RuntimeError, ValueError) as x:
--> 626                 raise TypeError(x)
    628     def _latex_(self):

TypeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.

Change History (5)

comment:1 Changed 8 years ago by Peter Bruin

Cc: Robert Bradshaw Nils Bruin Jean-Pierre Flori added

(CC-ing the authors of the Maxima library interface)

This seems to be caused by Sage trying to convert the SR.wild(42) object to Maxima. Your code causes Maxima to execute

sage0 : 'f($42,0,2) = 'f($42,1,0)$

but the dollar sign ends statements in Maxima.

The above line is executed via the Maxima library interface, which apparently gives you this cryptic error. Here is a simpler example:

sage: sage.calculus.calculus.maxima(SR.wild(42))    # Maxima library
RuntimeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.

The error is clearer when using the pexpect interface:

sage: maxima(SR.wild(42))                           # external Maxima program
TypeError: Error executing code in Maxima
        sage1 : $42$
Maxima ERROR:
        incorrect syntax: Premature termination of input at $.
sage1 : $

So there are two issues: the failing conversion and the cryptic error message.

comment:2 Changed 8 years ago by For batch modifications

Milestone: sage-6.3sage-6.4

comment:3 Changed 7 years ago by Daniel Krenn

Still there in 6.6

comment:4 Changed 5 years ago by Ralf Stephan

Summary: dictionary of symbolic expressions (functions) raises Maxima-errorwildcards are not converted to Maxima

comment:5 Changed 18 months ago by Samuel Lelièvre

Similar report at #21444.

Note: See TracTickets for help on using tickets.