MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Getting symbols out of list returned by solve

phry420 at (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]= ---------

Wolfram Research.

  • Prev by Date: Re: Crash problems with 4.2 FrontEnd
  • Next by Date: Direct tensor algebra
  • Previous by thread: Re: Getting symbols out of list returned by solve
  • Next by thread: how to avoid this evaluation?