Re: Hold and Equal

*To*: mathgroup at smc.vnet.net*Subject*: [mg73796] Re: Hold and Equal*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Wed, 28 Feb 2007 04:42:34 -0500 (EST)*Organization*: Uni Leipzig*References*: <erufqm$s7j$1@smc.vnet.net>*Reply-to*: kuska at informatik.uni-leipzig.de

Hi Murray, (HoldForm @@ {(a + b)^2 == Expand[(a + b)^2]}) /. Equal -> Set Regards Jens Murray Eisenberg wrote: > 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. > > > >