Search code examples
wolfram-mathematicamaple

Is there a "lhs" and "rhs" function in Mathematica that is similar to Maple?


In Maple, we can use "lhs" and "rhs" functions to retrieve the left or right hand side of an equation, but I can find a similar one in Mathematica. Could anyone suggest how to do this in Mathematica?

Thanks a lot.


Solution

  • See if you can adapt this.

    I name an equation e1 in this way

    e1 = x==y
    

    Then the lhs of e1 is

    e1[[1]]
    

    which returns

    x
    

    and the rhs of e1 is

    e1[[2]]
    

    which returns

    y