Re: How to prevent from simplification?
- To: mathgroup at smc.vnet.net
- Subject: [mg52475] Re: How to prevent from simplification?
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Sun, 28 Nov 2004 01:07:14 -0500 (EST)
- References: <co98i8$h2k$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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