RE: Using rules from Solve

*To*: mathgroup at smc.vnet.net*Subject*: [mg33692] RE: [mg33680] Using rules from Solve*From*: "David Park" <djmp at earthlink.net>*Date*: Mon, 8 Apr 2002 03:04:18 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

postman, In the first case, with delayed set, Mathematica first substitutes L wherever it appears on the rhs. But it doesn't appear on the rhs so no substitution is made. Mathematica then evaluates the rhs, which does introduce an L, but too late. In the second case, the definition is established with L in it. Now, when you use it, L is properly substituted. Anyway, would you really want to resolve the equation each time you call Rl? If you are interested, I have an extremely robust routine that will efficiently solve a single mass action chemical equilibrium equation and give the reactant concentrations to nearly the full precision of the floating point processor, over nearly the full exponent range of the floating point numbers. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > From: postman [mailto:post_12 at hotmail.com] To: mathgroup at smc.vnet.net > > > Hey All: > I appreciate any help with the following. I have a working solution, > but don't understand why my first attempt failed. I'm using Solve to > generate solutions to a set of simultaneous equations (the mass action > equations in chemistry), then want to use the resulting solutions to > calculate numerical values for specific values of the parameters. > > KdEqn={Kd==R*L/RL, RT=RL+R} > > Solve[KdEqn,RL,{RF}] gives me a rule, > > {{RL->L*RT/(Kd+L)}} > > and Replace[RL,Flatten[Solve[KdEqn,RL,{RF}]]] gives an expression > > L*RT/(Kd+L) > > that looks like what I would type on the right hand side of a > function: > > Rl[L_] := L*RT/(Kd+L) > > The problem is that > > Rl[L_] := Replace[RL,Flatten[Solve[KdEqn,RP]{Rf}]] > > fails; Rl[1] does not substitute the value "1" for "L". However, > > Rl[L_] = Replace[RL,Flatten[Solve[KdEqn,RP]{Rf}]] > > works as I want. Why does the := construct fail here? > > Thanks for any help! >