MathGroup Archive 2004

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

Search the Archive

Re: How to prevent from simplification?


Christian Auner wrote:
> How can I substitute values into an expression and prevent it from
> beeing evaluated and simplified?
> 
> Assume I have an expression like
> 
> a + b/c 
> 
> and I want to substitute values for a,b and such that the result looks
> like
> 
> number + number
> 
> That is the evalution stops right before the addition.
> 
> I already tried HoldForm but it didn't work.
> 
Hi,

Well HoldForm certainly worked for me:

sss = HoldForm[a + b/c]

a+b/c

sss /. {a -> 7, b -> 4, c -> 2}

7+4/2

(I had to edit the output slightly because InputForm shows the HoldForm 
wrapper, and StandardForm displays the fractions with a vertical bar).

David Bailey


  • Prev by Date: Re: How to prevent from simplification?
  • Next by Date: Re: Combining graphics and tabels in one cell
  • Previous by thread: Re: How to prevent from simplification?
  • Next by thread: Re: How to prevent from simplification?