Skip to content

f(expr,hold).n() fails for all generalized functions #16587

Closed
@rwst

Description

@rwst
sage: M = sgn((3/2),hold=True); M.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)).

Depends on #17130
Depends on #17285

CC: @kcrisman

Component: symbolics

Keywords: sgn, evaluation

Author: Ralf Stephan

Branch/Commit: e7880b7

Reviewer: Paul Masson

Issue created by migration from https://trac.sagemath.org/ticket/16587

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions