Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Re: Hold and Equal

  • To: mathgroup at
  • Subject: [mg73770] Re: [mg73739] Re: [mg73715] Hold and Equal
  • From: Murray Eisenberg <murray at>
  • Date: Wed, 28 Feb 2007 04:28:35 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <> <>
  • Reply-to: murray at

OK, that does what I explicitly asked for, but what I asked for was an 
oversimplified case of what I actually wanted...

The trouble with my example is that the left-hand side of the 
mathematical equality is an expression that Mathematica does not 
automatically "evaluate".  But suppose the left-hand side were, say, 
Integrate[x^2,x]?  Then when function step is applied to that, the 
integral is actually evaluated on both sides of the equality produced.

Moreover, if I try, say,


then Hold appears on both sides of the resulting equality.

What I'm after is something that will allow me to show an equation of 
the form, say,

     integral = evaluatedIntegral

where the left-hand side uses the integral sign and a "dx" (as an 
unevaluated expression), the right-hand side evaluates that integral, 
and the entire expression appears in traditional mathematical form.

Carl Woll wrote:
> 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

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: all the possible minors of a matrix
  • Next by Date: Re: all the possible minors of a matrix
  • Previous by thread: Re: Hold and Equal
  • Next by thread: Re: Hold and Equal