MathGroup Archive 2005

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

Search the Archive

Re: question about HoldForm


On 28 Sep 2005, at 14:41, Ruth Lazkoz wrote:

>
> Hi,
>
> I have this expression
>
> 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.
>
> Thanks,
>
> Ruth
>
>
>

Do you mean (x+2)^2?
Assuming so one possible way is something like this:


x = 2; v = HoldForm[x^2 + 4*x + 4];


Block[{x}, HoldForm[Evaluate[v /. HoldForm[u_] :> Factor[u]]]]


HoldForm[(x + 2)^2]

Andrzej Kozlowski



  • Prev by Date: Re: Bug in Mathematica ?
  • Next by Date: Sorting Strings: How and Why so f$&!ing hard?
  • Previous by thread: question about HoldForm
  • Next by thread: Re: question about HoldForm