Is there a simple way to grab or reference one side of an equation?
Minimal example of what I mean:
eq = x^2==3x
(*Pseudo Code*)
in: Grab_lefthandside(eq)
out: x^2
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityIs there a simple way to grab or reference one side of an equation?
Minimal example of what I mean:
eq = x^2==3x
(*Pseudo Code*)
in: Grab_lefthandside(eq)
out: x^2
You can change Equal to List and you will have the list of left and right hand sides of the equation.
First[List @@ (x^2 == 3 x)]
Part
, First
, Last
, etc. operate on expressions not just a List
. There is no need to convert to a List
to use them. Try f[a, b, c] // First
$\endgroup$
Aug 30, 2016 at 15:27
eq[[1]]
orFirst@eq
$\endgroup$FullForm[eq]
. $\endgroup$Part
s.Sin[x][[1]] gives
x, for instance. Even
Graphics` objects: look atFullForm[Plot[x, {x, 0, 1}]]
. $\endgroup$