       Re: extracting lhs or rhs of equations

• To: mathgroup at smc.vnet.net
• Subject: [mg16870] Re: [mg16853] extracting lhs or rhs of equations
• From: "Kevin J. McCann" <kevinmccann at Home.com>
• Date: Mon, 5 Apr 1999 02:24:15 -0400
• References: <199904020235.VAA11442@smc.vnet.net.>
• Sender: owner-wri-mathgroup at wolfram.com

```Two ways. I made the equation a little more complicated just to make sure
it works with more stuff on the LHS.

Method 1 (easier to see)

eq1 = (Sin[x] + Cos[x])^2 + 4/(2 + 3*x) == x;

eq1[]
4/(2 + 3*x) + (Cos[x] + Sin[x])^2

eq1[]
x

Method 2 (more in the spirit of Mathematica and pattern matching)

eq1
4/(2 + 3*x) + (Cos[x] + Sin[x])^2 == x

eq1/.(x_ == y__)->x
4/(2 + 3*x) + (Cos[x] + Sin[x])^2

eq1/.(x_ == y_)->y
x

Kevin

----- Original Message -----
From: David P. Johnson <johnson at ae.msstate.edu>
To: mathgroup at smc.vnet.net
Subject: [mg16870] [mg16853] extracting lhs or rhs of equations

> Let's say I have an expression like:
>
>   In:= eq1= Sin[x] == x;
>
> Is there a way to get just the left-hand side or right-hand side of the
> equation? Something like:
>
>   In:= LHS[eq1]
>   Out:= Sin[x]
>
> TIA.
>
> --
> David
> ->(Signature continues here)
>
>

```