MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Output of left-hand side of expression

I do not know your larger objective so I can only give some general advice.
First, in general it is better to use small letter variables in Mathematica,
as Mathematica sometimes reserves capital letter symbols.

Second, if you want to use a symbol as a symbol in further expressions then
don't set it to something else. In Mathematica = is the Set statement. It
sets the lhs symbol to be the rhs. After that, anytime you enter the lhs
symbol, Mathematica will immediately replace it by the rhs. In consequence,
the lhs symbol will nevermore appear in one of your output cells. (Unless
you put it in a Hold or HoldForm.)

Perhaps what you want is ==, which in Mathematica is a logical expression
giving True or False. But if you write

m = c + 1;
m == c + 1  you get

And if you wanted to solve the equation for c...

Solve[m == c + 1, c]

you obtain no solution because the equation is automatically True.

Often it is better to resist using the Set (=) statement. If you want to
continue using a symbol and using or manipulating expressions that contain
the symbol, then use rules rather than the set statement.


mRule = m -> c + 1;

Now you can write the equation for m and substitute the value with the rule.

m == c + 1
% /. mRule
m == 1 + c

You retain both sides of the equation in the first step. You could now also
solve for c.

Solve[m == c + 1, c]
{{c -> -1 + m}}

So the general idea is: if you want to keep using a symbol, don't Set it to
some other expression, rather use rules to affect the subsequent

David Park
djmp at

From: [mailto:J_M_1967 at]

This is really simple but I cannot find in manuals. (Honestly!)

Q. How do I display the left-hand side of an expression

currently I do


but I want


I need this so that I can copy/paste the entire expression into a doc. so
that it is complete - not just the right hand side or result.

Is there some magic command that can do this? or system default?


  • Prev by Date: Re: Expanding expressions with Dot, Times and Plus
  • Next by Date: Re: Problems with simulating society ch4 section 4.3
  • Previous by thread: Re: Output of left-hand side of expression
  • Next by thread: Re: Output of left-hand side of expression