Re: Differrence between version 2.03 and 2.1?
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: Differrence between version 2.03 and 2.1?
- From: nachbar at merck.com
- Date: Thu, 25 Feb 1993 13:04:58 -0500 (EST)
Leon Poon writes: > > While I have your attention, I wonder if you know an > easy way to turn the solutions of a Solve from a list of > replacement rules to simply elements of a list. Suppose > Solve[x==f[x],{x}]={{x->a},{x->b},{x->c}}, I want the list > {a,b,c} instead. I have come up with a cumbersome way of > doing this which is > solns=Table[x/.Flatten[solnlist=Solve[x==f[x],{x}]][[i]], > {i,Length[solnlist]}] > but I know there must be a better way. > one can map Part over the list as in In[1]:= Solve[0==3 x^2 + 4 x -15, x] 5 Out[1]= {{x -> -3}, {x -> -}} 3 In[2]:= Part[#[[1]],2]& /@ % 5 Out[2]= {-3, -} 3 bob -- Dr. Robert B. Nachbar | Merck Research Laboratories | 908/594-7795 nachbar at merck.com | R50S-100 | 908/594-4224 FAX | PO Box 2000 | | Rahway, NJ 07065 |