Skip to content

Equality of two expressions similar to sympy #496

Open
@dominikgeissler

Description

@dominikgeissler

Hello!
When trying to check the equality for two expressions I want to utilize a method similar to the .equals() method in sympy (see example below)

import sympy as sp
import symengine as se

# In Symengine
expr1: se.Expr = se.S("(y + 1)**10/1024")
expr2: se.Expr = se.S("((1/2 + (1/2)*y)**10)")
print(expr1 == expr2)                       # False
print(expr1.expand() == expr2.expand())     # True

# In Sympy
expr1: sp.Expr = sp.S("(y + 1)**10/1024")
expr2: sp.Expr = sp.S("((1/2 + (1/2)*y)**10)")
print(expr1 == expr2)                       # False
print(expr1.expand() == expr2.expand())     # True
# 👇 behaviour I want to have
print(expr1.equals(expr2))                  # True

Is there a way to do this in symengine without calling additional methods (as .expand()) or using sympy?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions