- To: mathgroup at smc.vnet.net
- Subject: [mg35114] Replacement question
- From: ginak <gina02122000 at yahoo.com>
- Date: Tue, 25 Jun 2002 03:41:28 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Suppose I have something like In  := h/f[2.33342] Out := 24.12711 and now I want to evaluate h/f[2.33342], i.e. the same as in In but replaceing h with h. This won't work In  := In /. h->h Out := 24.12711 because In is fully evaluated to 24.12711 before the rule is applied. (Generally, the expressions I'm interested in are more of a pain to type than h/f[2.33342]). How do I tell Mathematica to evaluate In only enough to apply the given substition rule, apply the substitution rule, and only then proceed with the evaluation? In fact, I don't even know how to do a replacement like In  := h/f[2.33342] /. h->h for the same reason: the LHS is evaluated before the rule can be applied. (Of course, in this case this replacment task is pointless, since it is so easy to type out the desired expression, but there are situations in which one can obtain a complicated expression by cutting and pasting, and wants to apply a substitution rule to the complicated expression before Mathematica evaluates it.) Thanks! G.