Re: positive root only using Solve[]
- To: mathgroup at smc.vnet.net
- Subject: [mg41841] Re: positive root only using Solve[]
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 6 Jun 2003 09:51:23 -0400 (EDT)
- References: <bbnaqt$2e2$1@smc.vnet.net>
- Reply-to: "Allan Hayes" <hay at haystack.demon.co.uk>
- Sender: owner-wri-mathgroup at wolfram.com
"seferiad" <seferiad at pacbell.net> wrote in message news:bbnaqt$2e2$1 at smc.vnet.net... > Hello, > Consider the following equation. > > Solve[x^2 ==1, x] > > Mathematica will output 1 and -1 for x. However, I only want Mathematica to > output the positive solution (i.e., x -> 1), so I can use this conveniently > in a subsequent equation. Is there a way to force the output to produce only > the positive solution? Thanks, Jay > seferiad, Three observations: Simplify[x^2 == 1 && x >= 0] x == 1 Select[Solve[x^2 == 1, x], #1[[1,2]] > 0 & ] {{x -> 1}} << "Algebra`InequalitySolve`" InequalitySolve[x^2 == 1 && x >= 0, x] x == 1 -- Allan --------------- Allan Hayes hay at haystack.demon.co.uk Voice: +44 (0)116 241 8747 Fax: +44 (0)870 164 0565