MathGroup Archive 2007

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

Search the Archive

Hold and Equal

  • To: mathgroup at
  • Subject: [mg73715] Hold and Equal
  • From: Murray Eisenberg <murray at>
  • Date: Mon, 26 Feb 2007 06:12:41 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • Reply-to: murray at

How can I produce in an Output cell (under program control) an 
expression like the following,

   (a+b)^2 = a^2+ 2 a b + b^2

where instead of the usual Equal (==) I get a Set (=), as in traditional 
math notation?  I want to input the unexpanded (a+b)^2 and have the 
expansion done automatically.

Of course, I can try something like the following:

   (a+b)^2 == Expand[(a+b)^2])

So how do I convert the == to =?  Of course

   ((a + b)^2 == Expand[(a + b)^2]) /. Equal -> Set

gives a Set::write error.  And

   (Hold[(a + b)^2 == Expand[(a + b)^2]]) /. Equal -> Set

doesn't actually evaluate the Expand part and leaves the "Hold" wrapper.

Murray Eisenberg                     murray at
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

  • Prev by Date: Re: Why Doesn't Mathematica Recognize System Dates?
  • Next by Date: Re: Symbol name extraction
  • Previous by thread: Pen, Tablet Input for Mathematica? (Some findings)
  • Next by thread: Re: Hold and Equal