#16592: bug in evaluation of maxima function with product/quotient/power 
argument
--------------------------+----------------------------
   Reporter:  rws         |            Owner:
       Type:  defect      |           Status:  new
   Priority:  major       |        Milestone:  sage-6.3
  Component:  interfaces  |         Keywords:
  Merged in:              |          Authors:
  Reviewers:              |  Report Upstream:  N/A
Work issues:              |           Branch:
     Commit:              |     Dependencies:
   Stopgaps:              |
--------------------------+----------------------------
 From the report in http://ask.sagemath.org/question/10961/problems-with-
 maximafunction-of-one-variable/
 {{{
 sage: var('f,k,x')
 (f, k, x)
 sage: F = maxima.function('x','f')
 sage: k=F(0)
 sage: F(k*x)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 <ipython-input-46-eb3fed206854> in <module>()
 ----> 1 F(k*x)

 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima_abstract.pyc in __call__(self, *args)
    2012         if len(args) == 1:
    2013             args = '(%s)'%args
 -> 2014         return P('%s%s'%(self.name(), args))
    2015
    2016     def __repr__(self):

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

 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima.pyc in __init__(self, parent, value,
 is_name, name)
    1127             True
    1128         """
 -> 1129         ExpectElement.__init__(self, parent, value, is_name=False,
 name=None)
    1130
    1131     def display2d(self, onscreen=True):

 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/interfaces/expect.pyc in __init__(self, parent, value,
 is_name, name)
    1304         else:
    1305             try:
 -> 1306                 self._name = parent._create(value, name=name)
    1307             # Convert ValueError and RuntimeError to TypeError for
    1308             # coercion to work properly.

 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/interfaces/interface.pyc in _create(self, value, name)
     387     def _create(self, value, name=None):
     388         name = self._next_var_name() if name is None else name
 --> 389         self.set(name, value)
     390         return name
     391

 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima.pyc in set(self, var, value)
     972             self._batch(cmd, batchload=True)
     973         else:
 --> 974             self._eval_line(cmd)
     975             #self._sendline(cmd)
     976             #self._expect_expr()

 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima.pyc in _eval_line(self, line,
 allow_use_file, wait_for_prompt, reformat, error_check, restart_if_needed)
     764         out = self._before()        # input echo + output prompt +
 output
     765         if error_check:
 --> 766             self._error_check(line, out)
     767         if not reformat:
     768             return out

 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima.pyc in _error_check(self, cmd, out)
     904         m = r.search(out)
     905         if not m is None:
 --> 906             self._error_msg(cmd, out)
     907
     908     def _error_msg(self, cmd, out):

 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima.pyc in _error_msg(self, cmd, out)
     921                 Principal Value
     922         """
 --> 923         raise TypeError("Error executing code in
 Maxima\nCODE:\n\t%s\nMaxima ERROR:\n\t%s"%(cmd, out.replace('-- an error.
 To debug this try debugmode(true);','')))
     924
     925     ###########################################

 TypeError: Error executing code in Maxima
 CODE:
         sage38 : sage33(                                      f x)$
 Maxima ERROR:
         incorrect syntax: X is not an infix operator
                 f x)
                   ^
 }}}
 On the other hand `F(k+k)`, `F(k*k)`, `F(k/x)`, and `F(k^x)` produces:
 {{{
 ...
 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/interfaces/maxima.pyc in _eval_line(self, line,
 allow_use_file, wait_for_prompt, reformat, error_check, restart_if_needed)
     759             return
     760         # line_echo sometimes has randomly inserted terminal echo
 in front #15811
 --> 761         assert line_echo.strip().endswith(line.strip()),
 'mismatch:\n' + line_echo + line
     762
     763         self._expect_expr(self._display_prompt)

 AssertionError: mismatch:
 sage41 : sage33(                                       f
 sage41 : sage33(                                       f
                                        -
                                        x)$
 }}}

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