#17503: pickled symbolic function breaks maxima interface
-------------------------+-------------------------------------------------
   Reporter:  wonder     |            Owner:
       Type:  PLEASE     |           Status:  new
  CHANGE                 |        Milestone:  sage-6.5
   Priority:  major      |         Keywords:  pickle, maxima, symbolic,
  Component:  PLEASE     |  function, sr_to_max
  CHANGE                 |          Authors:
  Merged in:             |  Report Upstream:  N/A
  Reviewers:             |           Branch:
Work issues:             |     Dependencies:
     Commit:             |
   Stopgaps:             |
-------------------------+-------------------------------------------------
 Like this:

 {{{
 $ sage
 ┌────────────────────────────────────────────────────────────────────┐
 │ Sage Version 6.4.1, Release Date: 2014-11-23                       │
 │ Type "notebook()" for the browser-based notebook interface.        │
 │ Type "help()" for help.                                            │
 └────────────────────────────────────────────────────────────────────┘
 sage: z = sage.symbolic.function_factory.function('z',nargs=1)
 sage: z_expr = solve( z(x) == x/(1-x), x )[0].rhs()
 sage: z_expr
 z(x)/(z(x) + 1)
 sage: limit(loads(dumps(z_expr)), x=0)
 limit(z(x)/(z(x) + 1), x, 0)
 sage: limit(z_expr, x=0)
 ---------------------------------------------------------------------------
 RuntimeError                              Traceback (most recent call
 last)
 <ipython-input-5-a3b6f4b6aa26> in <module>()
 ----> 1 limit(z_expr, x=Integer(0))

 /usr/local/sage/local/lib/python2.7/site-
 packages/sage/calculus/calculus.pyc in limit(ex, dir, taylor, algorithm,
 **argv)
    1249     if algorithm == 'maxima':
    1250         if dir is None:
 -> 1251             l = maxima.sr_limit(ex, v, a)
    1252         elif dir in ['plus', '+', 'right', 'above']:
    1253             if dir == 'above':

 /usr/local/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima_lib.pyc in sr_limit(self, expr, v, a, dir)
     937         """
     938         try:
 --> 939             L=[sr_to_max(SR(a)) for a in [expr,v,a]]
     940             if dir == "plus":
     941                 L.append(max_plus)

 /usr/local/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima_lib.pyc in sr_to_max(expr)
    1606             max_op_dict[op_max]=op
    1607         return EclObject(([sage_op_dict[op]],
 -> 1608                      [sr_to_max(o) for o in expr.operands()]))
    1609     elif expr.is_symbol() or expr.is_constant():
    1610         if not expr in sage_sym_dict:

 /usr/local/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima_lib.pyc in sr_to_max(expr)
    1606             max_op_dict[op_max]=op
    1607         return EclObject(([sage_op_dict[op]],
 -> 1608                      [sr_to_max(o) for o in expr.operands()]))
    1609     elif expr.is_symbol() or expr.is_constant():
    1610         if not expr in sage_sym_dict:

 /usr/local/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima_lib.pyc in sr_to_max(expr)
    1606             max_op_dict[op_max]=op
    1607         return EclObject(([sage_op_dict[op]],
 -> 1608                      [sr_to_max(o) for o in expr.operands()]))
    1609     elif expr.is_symbol() or expr.is_constant():
    1610         if not expr in sage_sym_dict:

 /usr/local/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima_lib.pyc in sr_to_max(expr)
    1602             op_max=maxima(op).ecl()
    1603             if op_max in max_op_dict:
 -> 1604                 raise RuntimeError("Encountered operator mismatch
 in sr-to-maxima translation")
    1605             sage_op_dict[op]=op_max
    1606             max_op_dict[op_max]=op

 RuntimeError: Encountered operator mismatch in sr-to-maxima translation
 sage:
 }}}

 I don't know the code well enough to diagnose, but from poking around in
 sr_to_max() it looks like we've got multiple operators with the same name
 'z', causing a collision in the dictionaries it uses to translate between
 sage's names and the names it passes into maxima.

--
Ticket URL: <http://trac.sagemath.org/ticket/17503>
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.

Reply via email to