replacement rules and a simple list
- To: mathgroup at yoda.physics.unc.edu
- Subject: replacement rules and a simple list
- From: koleh%joyl.dnet at joyx.joensuu.fi
- Date: Thu, 25 Feb 1993 09:46:50 +0300
Leon Poon asks if there is an easy way to turn the solutions of
a Solve from a list of replacement rules to simply elements of
a list. I think the following rule is very simple.
In[1]:= replace[{a_ -> b_}] := Replace[{a -> b}, {a -> b} -> b]
In[2]:= Solve[x^4==1,x]
Out[2]= {{x -> 1}, {x -> I}, {x -> -1}, {x -> -I}}
In[3]:= Map[replace,%]
Out[3]= {1, I, -1, -I}
Osmo Kolehmainen