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[[1]] 4/(2 + 3*x) + (Cos[x] + Sin[x])^2 eq1[[2]] 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[1]:= 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[2]:= LHS[eq1] > Out[2]:= Sin[x] > > TIA. > > -- > David > ->(Signature continues here) > >
- References:
- extracting lhs or rhs of equations
- From: "David P. Johnson" <johnson@ae.msstate.edu>
- extracting lhs or rhs of equations