Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*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: Hold and Equal

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73734] Re: Hold and Equal
  • From: dh <dh at metrohm.ch>
  • Date: Tue, 27 Feb 2007 05:41:50 -0500 (EST)
  • References: <erufqm$s7j$1@smc.vnet.net>


Hi Murray,

a quick and dirty solution that does not create evaluation problems is 

to convert your expression into a string and make the replacement there:

fun[x_]:= StringReplace[ToString[x], "==" -> "="]

if you now say: fun[(a + b)^2 == Expand[(a + b)^2]] you get:

        2     2            2

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



Daniel



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.

> 

> 

> 

> 




  • Prev by Date: Re: Hold and Equal
  • Next by Date: Re: Hold and Equal
  • Previous by thread: Re: Hold and Equal
  • Next by thread: Re: Re: Hold and Equal