Opened 4 years ago

Last modified 3 years ago

## #26727 new defect

# Make SR('x == 0') work, and likewise for <, >, <=, >=, !=, <> — at Version 1

Reported by: | Samuel Lelièvre | Owned by: | |
---|---|---|---|

Priority: | major | Milestone: | sage-wishlist |

Component: | symbolics | Keywords: | SymbolicRing, string, equation |

Cc: | Samuel Lelièvre | Merged in: | |

Authors: | Reviewers: | ||

Report Upstream: | N/A | Work issues: | |

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description (last modified by )

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 Ask Sage user !IoSuarezB in the discussion around Ask Sage question 41135.

**Note:**See TracTickets for help on using tickets.