Mathematica 9 is now available
Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: system of simultaneous equations

  • To: mathgroup at
  • Subject: [mg22948] Re: [mg22895] system of simultaneous equations
  • From: "Tomas Garza" <tgarza at>
  • Date: Fri, 7 Apr 2000 02:54:31 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

David Braunholtz wrote:

> WHile I've got the attention of a Mathematica expert, I am wanting to
> select a single root of a system of simultaneous equations (with
> positive values for all 3 variables) - and (being new to mathematica)
> cannot work out how to do this. I successfully get a list of roots, but
> cannot make the (you would think) easy step to reduce the list to
> only (positive) roots. Any help VERY gratefully received. I have
> searched in Mathgroup at Wolfram without finding anything.

Bear in mind that Solve gives solutions in terms of rules of the form x ->
sol. To give an example, let

r := Random[Integer, {1, 9}];

sols = Solve[
      r x + r y + r z == r && r x + r y + r z == r &&
        r x + r y + r z == r, {x, y, z}] // Flatten
{x -> 4, y ->-49/3, z -> 25/3}

This is a list of rules, each giving the value of the corresponding
variable. Each member of this list is a list, too. For example,

x -> 4


sols[[1, 2]]

If you want a list of just the numerical values of the solutions, take

vals = #[[2]] & /@ sols
{4,-49/3, 25/3}

and if you want to pick only the positive ones, use Select:

Select[vals, # > 0 &]
{4, 25/3}

Tomas Garza
Mexico City

  • Prev by Date: RE: 2-D Vector Field scale ?
  • Next by Date: Re: Apparently easy ODE
  • Previous by thread: Re:system of simultaneous equations
  • Next by thread: Edit Mathematica graphics in Adobe