Re: Choose one solution in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg36111] Re: [mg36095] Choose one solution in Mathematica
- From: BobHanlon at aol.com
- Date: Thu, 22 Aug 2002 04:32:48 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 8/21/02 6:56:16 AM, roberto.de_santis at ecb.int writes:
>Assume that
>
>x^2 - 2x + 1 = 0
>
>The two solutions are x = -1 and x = 1.
>If I assume that x > 0, then the only relevant solution would be x = 1.
>
>How can I tell this to Mathematica?
>
>Solve[x^2 - 2x + 1 = 0, x]
>
>and then........
>
Solve[x^2-1==0,x]
{{x -> -1}, {x -> 1}}
Select[Solve[x^2-1==0,x], (x /. #)>0&]
{{x -> 1}}
Cases[Solve[x^2-1==0,x], {x->_?Positive}]
{{x -> 1}}
Needs["Algebra`InequalitySolve`"];
InequalitySolve[x^2-1==0 && x>0, x]
x == 1
Bob Hanlon
Chantilly, VA USA