Opened 13 months ago

Last modified 7 months ago

#26727 new defect

Make SR('x == 0') work, and likewise for <, >, <=, >=, !=, <>

Reported by: slelievre Owned by:
Priority: major Milestone: sage-wishlist
Component: symbolics Keywords: SymbolicRing, string, equation
Cc: slelievre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by slelievre)

While SR('3*x + 2') correctly returns 3*x + 2, calling SR on strings representing equations or inequations, such as SR('x == 0') or SR('x < 0') or similar, choke on ==, <, etc.

All of the following are valid:

sage: x == 0
x == 0
sage: x < 0
x < 0
sage: x <= 0
x <= 0
sage: x > 0
x > 0
sage: x >= 0
x >= 0
sage: x != 0
x != 0
sage: x <> 0
x != 0

so one would expect the following to work too:

sage: SR('x == 0')
x == 0
sage: SR('x < 0')
x < 0
sage: SR('x <= 0')
x <= 0
sage: SR('x > 0')
x > 0
sage: SR('x >= 0')
x >= 0
sage: SR('x != 0')
x != 0
sage: SR('x <> 0')
x != 0

Instead we get for example:

sage: print(version())
SageMath version 8.4, Release Date: 2018-10-17
sage: SR('x == 0')
Traceback (most recent call last)
...
TypeError: Malformed expression: x == !!!  0

Initially reported by Ludger O. Suarez-Burgoa in the discussion around Ask Sage question 41135.

Change History (3)

comment:1 Changed 13 months ago by slelievre

  • Description modified (diff)

comment:2 Changed 13 months ago by slelievre

  • Description modified (diff)

comment:3 Changed 7 months ago by slelievre

  • Milestone changed from sage-8.5 to sage-wishlist

Change milestone to sage-wishlist for a few tickets whose previous milestone is closed.

Note: See TracTickets for help on using tickets.