Re: How to prevent from simplification?
- To: mathgroup at smc.vnet.net
- Subject: [mg52469] Re: [mg52441] How to prevent from simplification?
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 28 Nov 2004 01:06:56 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Christian,
There is a package, ExpressionManipulation.m, and an associated tutorial
EvaluationTutorial.nb, at my web site below that may help with your problem.
Ted Ersek helped me with this package.
It has routines for selective manipulation and evaluation of expressions in
held expressions.
For your example we could do...
Needs["Algebra`ExpressionManipulation`"]
HoldForm[a + b/c]
% /. {a -> 1, b -> 4, c -> 2}
% // EvaluateAtPattern[_Times]
% // EvaluateAtPattern[_Plus]
giving in succession...
a + b/c
1 + 4/2
1 + 2
3
Or with a different choice of values...
HoldForm[a + b/c]
% /. {a -> 1, b -> 2, c -> 3}
% // EvaluateAtPattern[_Times, \[Infinity], N]
% // EvaluateAtPattern[_Plus]
a + b/c
1 + 2/3
1 + 0.66667
1.66667
In the third step an extended form of EvaluateAtPattern was used to convert
2/3 to an approximate number by applying the N function.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Christian Auner [mailto:mca at nurfuerspam.de]
To: mathgroup at smc.vnet.net
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.