RE: Seemingly strange behavior - HoldForm and Evaluate
- To: mathgroup at smc.vnet.net
- Subject: [mg68136] RE: [mg68109] Seemingly strange behavior - HoldForm and Evaluate
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 25 Jul 2006 04:01:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
HoldForm has only one argument and you need to evaluate that. a = 2; b = 3; HoldForm[Evaluate[a + b]] 5 David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Bharat Bhole [mailto:bbhole at gmail.com] To: mathgroup at smc.vnet.net I came across this when answering one of the queries posted on this forum. If I write (1) In: a = 2; HoldForm[a] Out: a (2) In: a=2; HoldForm[Evaluate[a]] Out: 2 (3) In: a=2; b=3; HoldForm[Evaluate[a] + Evaluate[b]] Out: Evaluate[a] + Evaluate[b] Example 2 seems to suggest that Evaluate works as expected, i.e., it evaluates the expression assigns value 2 despite the HoldAll attribute of HoldForm. However, in example 3, evaluate does not function as expected, or may it does, but I do not understand why a and b are not assigned there values. Thanks, Bharat.