Re: Hold and Equal
- To: mathgroup at smc.vnet.net
- Subject: [mg73739] Re: [mg73715] Hold and Equal
- From: Carl Woll <carlw at wolfram.com>
- Date: Tue, 27 Feb 2007 05:44:35 -0500 (EST)
- References: <200702261112.GAA27677@smc.vnet.net>
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. > > Murray, How about using HoldForm? step[x_] := HoldForm[x = #] &[Expand[x]] step[(a+b)^2] (a+b)^2=a^2+2 b a+b^2 Carl Woll Wolfram Research
- Follow-Ups:
- Re: Re: Hold and Equal
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: Re: Hold and Equal
- References:
- Hold and Equal
- From: Murray Eisenberg <murray@math.umass.edu>
- Hold and Equal