Re: How to choose real positive solutions?
- To: mathgroup at smc.vnet.net
- Subject: [mg74309] Re: How to choose real positive solutions?
- From: "dimitris" <dimmechan at yahoo.com>
- Date: Sun, 18 Mar 2007 00:45:49 -0500 (EST)
- References: <etg46h$ijg$1@smc.vnet.net>
Hi Manfred. You should have posted also your system of equations. In this way we would have helped us very much! Ayway... Copy/Paste the following in a notebook, select the cell and press Shift +Enter Print[StyleForm["a system of three equations in three unknowns", FontColor -> Blue]] eq1 = x + y + 10*z^7 == 5 eq2 = -4*x^2 - y + 2*z^3 == 0 eq3 = 6*x^2 + 5*y^7 + 4*z == 11 roots = NSolve[{eq1, eq2, eq3}, {x, y, z}]; Print[StyleForm["the number of solutions", FontColor -> Blue]] Length[roots] Print[StyleForm["a shorted form of", FontColor -> Blue, FontSlant -> Italic], StyleForm[" solutions", FontColor -> Blue]] Short[roots, 10] Print[StyleForm["only positive solutions", FontColor -> Blue]] Cases[{x, y, z} /. roots, {(a_Real)?Positive, (b_Real)?Positive, (c_Real)?Positive} :> {x -> a, y -> b, z -> c}] Regards Dimitris mandix wrote: > Hi, > suppose I want to solve a system of 3 equations and 3 unknowns > (polynomial of degree whatever, say n). Is there a way to tell NSolve > to return only real and positive solutions (and ignore the rest)? > > thanks you so much, > > Manfred