Re: system of simultaneous equations

*To*: mathgroup at smc.vnet.net*Subject*: [mg22923] Re: [mg22895] system of simultaneous equations*From*: Bojan Bistrovic <bojanb at python.physics.odu.edu>*Date*: Thu, 6 Apr 2000 02:04:39 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

> 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. > > Cheers > > > David Braunholtz > Department of Public Health & Epidemiology > Public Health Building > University of Birmingham > Birmingham B15 2TT > E-Mail: D.A.Braunholtz at bham.ac.uk > Tel: 0121-414-7495 > FAX: 0121-414-7878 > Assuming that your results are in the form results={ {x1,y2,z1}, {x2,y2,z2}, {x3,y3,z3}, ...} you would select the ones where all {xn,yn,zn} are positive with Select[results, (And@@Map[Positive,#])& ] If you are using Solve or something like that to get your results, they would be in a form results2={ {x->x1, y->y1,z->z1},{x->x2, y->y2,z->z2},{x->x3, y->y3,z->z3}, ...} In this case you'd have to modify the line to Select[results2, (And@@Map[Positive[#[[2]]]&,#])&] Here's some examples: In[1]:= results={{1,2,3},{-3,4,5},{4,-5,6},{7,8,9},{2+3I,4,5},{3,5+5I,7}}; In[2]:= results2={ {x->1,y->2,z->3}, {x->-3,y->4,z->5}, {x->7,y->8,z->9}, {x->2+3I,y-> 4,z->5}} In[3]:= Select[results, (And@@Map[Positive,#])& ] Out[3]={{1,2,3},{7,8,9}} In[4]:= Select[results2, (And@@Map[Positive[#[[2]]]&,#])&] Out[4]={{x -> 1,y -> 2,z -> 3},{x -> 7,y -> 8,z -> 9}} Bye, Bojan -- --------------------------------------------------------------------- Bojan Bistrovic, bojanb at jlab.org Old Dominion University, Norfolk VA & Jefferson Lab, Newport News, VA ---------------------------------------------------------------------