MathGroup Archive 2005

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

Search the Archive

Re: question about HoldForm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60790] Re: question about HoldForm
  • From: albert <awnl at arcor.de>
  • Date: Thu, 29 Sep 2005 05:40:57 -0400 (EDT)
  • References: <dhdbc3$8eg$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,
 
> x = 2; HoldForm[x^2 + 4x + 4]
> 
> Is there a way to operate on HoldForm so that I get (x^2+2)^2? If I cut
> a paste the result and operate on it I obviously get 16.

This should do what you want:

x = 2;
expr = HoldForm[x^2 + 4x + 4];

Block[{x}, HoldForm @@ {(Factor @@ expr)}]

Anyway it is a good idead to not set symbols you want to use as parameters
in expressions to values in the first place. You an then insert values
whenever needed with ReplaceAll ( /. ):

expr=x^2 + 4x + 4
Factor[expr]
expr /. { x -> 2 }


albert


  • Prev by Date: Re: what is wrong with this plot?
  • Next by Date: Re: what is wrong with this plot?
  • Previous by thread: Re: Re: question about HoldForm
  • Next by thread: Re: question about HoldForm