Skip to content

Symbolic methods work inconsistently on relational expressions #21862

Open
@eviatarbach

Description

@eviatarbach

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)

Component: symbolics

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions