MathGroup Archive 1998

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

Search the Archive

Re: ``flattening" systems of equations




Selwyn Hollis wrote:

> What is the  simplest way to convert a system of equations like this:
>
> {{a,b,...}=={c,d,...}, e==f}
>
> into this:
>
> {a==c, b==d,..., e==f}?
>
> (Solve[] works on systems in either form, but FindRoot[] seems to
> require the second.)
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dr. Selwyn Hollis
> Associate Professor of Mathematics
> Armstrong Atlantic State University
> Savannah, GA 31419 USA
> <http://www.math.armstrong.edu/faculty/hollis/>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In[1]:=
{{a,b}=={c,d}, e==f}/.(p_List==q_:> Thread[p==q])//Flatten

Out[1]=

     a == c

     b == d

     e == f

or

In[2]:=
{{a,b}=={c,d}, e==f}/.(p:Equal[_List,_]:> Thread[p])//Flatten

Out[2]=

     a == c

     b == d

     e == f

But, because of

In[3]:=
Equal[__List]

Out[3]=

     True

In[4]:=
{{a,b}=={c,d}, e==f}/.(p:HoldPattern[Equal[__List]]:>
Thread[p])//Flatten

Out[4]=

     a == c

     b == d

     e == f


--
Allan Hayes
Mathematica Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642





  • Prev by Date: Re: Defining functions using arguments with subscripts
  • Next by Date: Re: ``flattening" systems of equations
  • Prev by thread: Re: ``flattening" systems of equations
  • Next by thread: Re: ``flattening" systems of equations