[Date Index]
[Thread Index]
[Author Index]
RE: Re: Hold and Equal
*To*: mathgroup at smc.vnet.net
*Subject*: [mg73760] RE: [mg73739] Re: [mg73715] Hold and Equal
*From*: "Virgilio, Vincent - SSD" <Vincent.Virgilio at itt.com>
*Date*: Wed, 28 Feb 2007 04:23:09 -0500 (EST)
Mr. Woll,
step[] has an interesting syntactic style. Did you intentionally group
"&" with the following argument, rather than with the preceding Function
body? That reminds me of the alternative practices between C and C++,
which either groups "*" with the declarator (C) or the type specifier
(C++).
Vince Virgilio
-----Original Message-----
From: Carl Woll [mailto:carlw at wolfram.com]
Sent: Tuesday, February 27, 2007 5:45 AM
To: mathgroup at smc.vnet.net
Subject: [mg73760] [mg73739] Re: [mg73715] Hold and Equal
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
************************************
This e-mail and any files transmitted with it are proprietary and intende=
d solely
for the use of the individual or entity to whom they are addressed. If yo=
u have
received this e-mail in error please notify the sender. Please note that =
any views
or opinions presented in this e-mail are solely those of the author and d=
o not
necessarily represent those of ITT, Inc. The recipient should check
this e-mail and any attachments for the presence of viruses. ITT accepts
no liability for any damage caused by any virus transmitted by this e-mai=
l.
************************************
=0D
Prev by Date:
**Re: Problems...**
Next by Date:
**Re: Hold and Equal**
Previous by thread:
**Re: Hold and Equal**
Next by thread:
**Re: Hold and Equal**
| |