MathGroup Archive 2007

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

Search the Archive

Re: Parse results from Solve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73919] Re: Parse results from Solve
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 3 Mar 2007 01:01:30 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <es916i$2u2$1@smc.vnet.net>

nikki_74 wrote:
> I have used the Solve command to get the solutions for a system of equations. However I want to use these solutions in other commands, such as Reduce and Simplify. 
> 
> For instance, say the output of Solve is,
> sols= {{x->0,y->0},{x->1,y->2}}
> 
> and I want all solutions where x!=y , or , all solutions where y>1. 
> 
> Can anybody help with this? Thanks!
> 

You could use the Cases function as in the following.

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

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

In[2]:=
Cases[sols, {rx_, ry_} /; (x /. rx) != (y /. ry)]

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

In[3]:=
Cases[sols, {rx_, ry_} /; (y /. ry) > 1]

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

Regards,
Jean-Marc


  • Prev by Date: Re: Parse results from Solve
  • Next by Date: Re: Integrals involving square roots
  • Previous by thread: Re: Parse results from Solve
  • Next by thread: Re: Parse results from Solve