MathGroup Archive 2007

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

Search the Archive

Re: Parse results from Solve


One way is to use Select:

In[1]:= sols= {{x->0,y->0},{x->1,y->2}};

In[2]:= Select[sols, x!=y /. # &]

Out[2]= {{x -> 1, y -> 2}}

In[3]:= Select[sols, y>1 /. # &]

Out[3]= {{x -> 1, y -> 2}}

In[4]:= ?Select
Select[list, crit] picks out all elements ei of list for which crit[ei] is True.
   Select[list, crit, n] picks out the first n elements for which crit[ei] is True.


If you want to turn the result into something that Reduce could use, you could do something like:

Or@@Map[And@@#&, sols /. Rule->Equal]

This changes the rules to equalities, turns the inner lists into conjunctions (And) and the outer one into a disjunction (Or).

In[5]:= Or@@Map[And@@#&, sols /. Rule->Equal]

Out[5]= (x == 0 && y == 0) || (x == 1 && y == 2)

Bhuvanesh,
Wolfram Research.


  • Prev by Date: Re: Problems with simplify and Sqrt[a^2]
  • Next by Date: Re: Parse results from Solve
  • Previous by thread: Re: Parse results from Solve
  • Next by thread: Re: Parse results from Solve