MathGroup Archive 2007

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

Search the Archive

Re: Parse results from Solve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73935] Re: Parse results from Solve
  • From: Bhuvanesh <lalu_bhatt at yahoo.com>
  • Date: Sat, 3 Mar 2007 01:10:17 -0500 (EST)

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