#20204: problems with constructing or converting to SymPy expressions
-----------------------------+------------------------
Reporter: rws | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-7.1
Component: symbolics | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-----------------------------+------------------------
Description changed by rws:
Old description:
> In the Sympy-1.0 upgrade the `UndefinedFunction._sage_` method is patched
> away to enable the important upgrade. This function was planned to
> resolve part of #14723 but uncovers missing functionality in the coercion
> system, and probably with symbolics. The following doctest in french_book
> fails if `UndefinedFunction._sage_` is defined:
> {{{
> sage: from sympy import Function, Symbol
> sage: u = Function('u'); n = Symbol('n', integer=True)
> sage: f = u(n+2)-(3/2)*u(n+1)+(1/2)*u(n)
> NotimplementedError
> }}}
>
> tscrim found the minimal cases:
> > {{{
> > sage: f = function('f')
> > sage: x = var('x')
> > sage: sympy.sympify(f(x), evaluate=False)
> > f(x)
> > sage: sympy.sympify(3*f(x), evaluate=False)
> > AttributeError: 'Call' object has no attribute 'id'
> > }}}
> > However, we do seem to have our own troubles of constructing !SymPy
> objects from symbolic expressions. All of these result in errors:
> > {{{
> > sage: f._sympy_()
> > sage: f(x)._sympy_()
> > sage: (f(x)+3)._sympy_()
> > }}}
>
> This means that Sympy-1.0 probably only uncovered already existing
> problems in expression conversion. This ticket should remove the patch in
> `build/pkgs/sympy` and resolve all mentioned problems.
>
> See #20185 for all previous discussion on this.
New description:
In the Sympy-1.0 upgrade the `UndefinedFunction._sage_` method is patched
away to enable the important upgrade. This function was planned to resolve
part of #14723 but uncovers problems with symbolics. The following doctest
in french_book fails if `UndefinedFunction._sage_` is defined:
{{{
sage: from sympy import Function, Symbol
sage: u = Function('u'); n = Symbol('n', integer=True)
sage: f = u(n+2)-(3/2)*u(n+1)+(1/2)*u(n)
NotimplementedError
}}}
tscrim found the minimal cases:
> {{{
> sage: f = function('f')
> sage: x = var('x')
> sage: sympy.sympify(f(x), evaluate=False)
> f(x)
> sage: sympy.sympify(3*f(x), evaluate=False)
> AttributeError: 'Call' object has no attribute 'id'
> }}}
> However, we do seem to have our own troubles of constructing !SymPy
objects from symbolic expressions. All of these result in errors:
> {{{
> sage: f._sympy_()
> sage: f(x)._sympy_()
> sage: (f(x)+3)._sympy_()
> }}}
This means that Sympy-1.0 probably only uncovered already existing
problems in expression conversion. This ticket should remove the patch in
`build/pkgs/sympy` and resolve all mentioned problems.
See #20185 for all previous discussion on this.
--
--
Ticket URL: <http://trac.sagemath.org/ticket/20204#comment:1>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.