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: [mg73738] Re: [mg73715] Hold and Equal
  • From: "Chris Chiasson" <chris at chiasson.name>
  • Date: Tue, 27 Feb 2007 05:44:02 -0500 (EST)
  • References: <200702261112.GAA27677@smc.vnet.net>

There are a lot of ways to handle that held expression. I recommend
reading Robby Villegas' summary of working with held expressions
because it nicely covers most of the methods I've ever learned:

http://library.wolfram.com/conferences/devconf99/villegas/UnevaluatedExpressions/

For a different tactic, you could try directly modifying the
FormatValues of Equal. I obtained the template for this rule by
looking at the TraditionalForm version:

Unprotect@Equal
Update@Equal
HoldPattern[MakeBoxes[Equal[BoxForm`elems___]/;
2<=Length[Unevaluated[{BoxForm`elems}]],StandardForm]]:=
(RowBox[BoxForm`Intercalate[#1,"="]]&)[
Thread[Unevaluated[MakeBoxes[{BoxForm`elems},StandardForm]]]
]

You could also use "\[LongEqual]" in place of "=" if you want to
maintain the ability to copy/paste input without losing the built-in
semantics.

On 2/26/07, Murray Eisenberg <murray at math.umass.edu> 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 Eisenberg                     murray at math.umass.edu
> 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
>
>


-- 
http://chris.chiasson.name/


  • References:
  • Prev by Date: Re: "movie" of Table output for web page
  • Next by Date: Why is 1 smaller than 0?
  • Previous by thread: Re: Re: Hold and Equal
  • Next by thread: Re: Hold and Equal