#16587: f(expr,hold).n() fails for all generalized functions
-------------------------------------+-------------------------------------
       Reporter:  rws                |        Owner:
           Type:  defect             |       Status:  new
       Priority:  major              |    Milestone:  sage-6.4
      Component:  symbolics          |   Resolution:
       Keywords:  sgn, evaluation    |    Merged in:
        Authors:                     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/rws/f_expr__n___fails_for_all_generalized_functions|  
cc22a9b489a841b23a6e9455bfea80a0b423c0e1
   Dependencies:  #17130, #17285     |     Stopgaps:
-------------------------------------+-------------------------------------
Description changed by rws:

Old description:

> As reported in http://ask.sagemath.org/question/8535/problem-with-sign-
> sgn-and-n/ by Louis Cypher:
> {{{
> sage: M = sgn(cos(3/2))
> sage: M.n()
> TypeError                                 Traceback (most recent call
> last)
> <ipython-input-5-0f11e9bd1e87> in <module>()
> ----> 1 M.n()
>
> /home/ralf/sage/local/lib/python2.7/site-
> packages/sage/symbolic/expression.so in
> sage.symbolic.expression.Expression._numerical_approx
> (build/cythonized/sage/symbolic/expression.cpp:24086)()
>
> TypeError: cannot evaluate symbolic expression numerically
> }}}
> kcrisman:
>
> Problem seems to be that in `M.n??` we see that it's looking for
> `is_a_numeric(x._gobj)` but apparently that fails, as does the constant,
> so it thinks we are looking at evaluating `sgn(cos(x))` instead of
> `sgn(cos(3/2))`.
>
> UPDATE:
> The problem also appears with `polylog(2.,.9).n()` for example.

New description:

 {{{
 sage: M = sgn((3/2),hold=True); M.n()
 ...
 TypeError: cannot evaluate symbolic expression numerically
 sage: polylog(2.,.9).n()
 ...
 TypeError: cannot evaluate symbolic expression numerically

 }}}
 The original problem is now resolved, it was reported in
 http://ask.sagemath.org/question/8535/problem-with-sign-sgn-and-n/ by
 Louis Cypher:
 {{{
 sage: M = sgn(cos(3/2))
 sage: M.n()
 TypeError                                 Traceback (most recent call
 last)
 <ipython-input-5-0f11e9bd1e87> in <module>()
 ----> 1 M.n()

 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/symbolic/expression.so in
 sage.symbolic.expression.Expression._numerical_approx
 (build/cythonized/sage/symbolic/expression.cpp:24086)()

 TypeError: cannot evaluate symbolic expression numerically
 }}}
 kcrisman:

 Problem seems to be that in `M.n??` we see that it's looking for
 `is_a_numeric(x._gobj)` but apparently that fails, as does the constant,
 so it thinks we are looking at evaluating `sgn(cos(x))` instead of
 `sgn(cos(3/2))`.

--

--
Ticket URL: <http://trac.sagemath.org/ticket/16587#comment:20>
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