8000 Improper expressions from SR(string) · Issue #22525 · sagemath/sage · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Improper expressions from SR(string) #22525
Closed
@rwst

Description

@rwst

Strings are not translated into proper Sage expressions for some functions:

sage: SR("sin(x)")
sin(x)
sage: type(_.operator())
<class 'sage.functions.trig.Function_sin'>
sage: SR("arcsin(x)")
arcsin(x)
sage: type(_.operator())
<class 'sage.functions.trig.Function_arcsin'>
sage: SR("asin(x)")
asin(x)
sage: type(_.operator())
<class 'sage.symbolic.function_factory.NewSymbolicFunction'>

Previous ticket description:

sage: integrate(((-1-3*x)^(-1/2)*(-1+3*x)^(-1/2)),x,algorithm='fricas')
-2/3*atan(1/3*(sqrt(3*x - 1)*sqrt(-3*x - 1) - 1)/x)
sage: _.subs(x==.1)
-2/3*atan(-6.51313067138982 + 3.89412863198815e-16*I)
sage: _.n()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-29-875d0b089ddd> in <module>()
----> 1 _.n()

/home/ralf/sage/src/sage/structure/element.pyx in sage.structure.element.Element.n (build/cythonized/sage/structure/element.c:7987)()
    836             0.666666666666667
    837         """
--> 838         return self.numerical_approx(prec, digits, algorithm)
    839 
    840     N = deprecated_function_alias(13055, n)

/home/ralf/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:33844)()
   5566             res = x.pyobject()
   5567         else:
-> 5568             raise TypeError("cannot evaluate symbolic expression numerically")
   5569 
   5570         # Important -- the  we get might not be a valid output for numerical_approx in

TypeError: cannot evaluate symbolic expression numerically

Already the second command should have evaluated to a floating point value.

CC: @mantepse

Component: symbolics

Keywords: FriCAS

Author: Frédéric Chapoton

Branch/Commit: f9b0635

Reviewer: Martin Rubey

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0