Re: Getting symbols out of list returned by solve
- To: mathgroup at smc.vnet.net
- Subject: [mg37403] Re: Getting symbols out of list returned by solve
- From: lalu_bhatt at yahoo.com (Bhuvanesh)
- Date: Sat, 26 Oct 2002 02:04:20 -0400 (EDT)
- References: <ap5g7d$4kn$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
phry420 at yahoo.com (Sam) wrote: > This may be really simple but I am having trouble setting the > variables to the values returned by solve. If > solution={S0 -> 0,S1 -> 5....}the numbers of S# are subscripts > I can get to the idivdual parts with > solution[[1]][[1]] and solution[[1]][[2]] but when I try to set the > one equal to the other I get this error > Set::"setps": solution[[1]] in assignment of part is not a symbol." > What is going on and how can I fix this? Perhaps you can use something like this: In[1]:= Solve[x + y == a && x - y == b, {x, y}] -(-a - b) -(-a + b) Out[1]= {{x -> ---------, y -> ---------}} 2 2 In[2]:= % /. Rule[sym_,val_] :> Set[sym,val]; In[3]:= x -(-a - b) Out[3]= --------- 2 -- Bhuvanesh, Wolfram Research.