Re: using a previous result

*To*: mathgroup at smc.vnet.net*Subject*: [mg67351] Re: using a previous result*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Mon, 19 Jun 2006 00:01:14 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On 6/18/06 at 5:13 AM, ridley_david at yahoo.com wrote: >Once I've solved a system of equations, I would like to use the >previous results in future equations. If my output is >{{p1->x,p2->y}} how do I assign those values as p1star and p2star so >I can reuse them? This will do what you want {p1star,p2star}={p1,p2}/.First@{{p1->x,p2->y}} But note often it isn't necessary to extract the values from rules. For example here is a root of a simple polynomial In[17]:= root=FindRoot[x^2-.5x-1,{x,0}] Out[17]= {x -> -0.7807764064044151} Now this can be used to evaluate any expression of x say 2 x + 1 as follows: In[18]:= 2 x+1/.root Out[18]= -0.561553 -- To reply via email subtract one hundred and four