Opened 3 years ago

Last modified 3 years ago

## #21862 new defect

# Symbolic methods work inconsistently on relational expressions

Reported by: | eviatarbach | Owned by: | |
---|---|---|---|

Priority: | major | Milestone: | sage-7.5 |

Component: | symbolics | Keywords: | |

Cc: | Merged in: | ||

Authors: | Reviewers: | ||

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

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description

Symbolic methods on relational expressions (equalities and inequalities) work inconsistently. Some of them directly apply to both sides, some don't do anything at all, and some behave unexpectedly.

For example, `collect`

does nothing (same with inequalities):

sage: var('y') y sage: eq = x^2 + x*y + 3*x == 0 sage: eq.collect(x) x^2 + x*y + 3*x == 0 sage: eq.lhs().collect(x) x^2 + x*(y + 3)

`limit`

behaves differently with different arguments, and it's not at all clear what it's doing:

sage: eq = exp(-x) == x sage: eq.limit(x=0) 0 sage: eq.limit(x=2) e^(-2) == 2

`factor`

takes equalities and returns a non-relational expression:

sage: (x^2 + x == 0).factor() (x + 1)*x

and doesn't work at all with inequalities:

sage: (x^2 + x > 0).factor() ValueError: Unable to represent as a polynomial

Even more strange:

sage: (x == 3).exp() e^(x == 3)

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

See also #7660 (EDIT: and #11651).