Re: using answer form reduce
- To: mathgroup at smc.vnet.net
- Subject: [mg68633] Re: using answer form reduce
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 14 Aug 2006 06:44:05 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <ebmtf5$6fb$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
akil wrote:
> After using reduce I get the following two types of answers:
>
> answer == Real1 || answer == Real2
> or
> answer == Real3
> , the type can change from one formula to another.
>
> I need the Reals, and put them all in a list. The problem is getting all the
> reals, without knowing which type I deal with, it should be able to be done
> fast.
>
> I tried making a list of the returned adres, and then using
> Cases[list, _Real, Infinity] and using Select[list,NumericQ] but both do not
> give me the answer I require.
>
> How can I get the answer I require e.g. something like {Real1,Real2,Real3}
What about the following?
sols = Reduce[x^4 == 4]
--> x == -Sqrt[2] || x == (-I)*Sqrt[2] || x == I*Sqrt[2] || x == Sqrt[2]
Select[x /. {ToRules[sols]}, Im[Chop[#1]] == 0 & ]
--> {-Sqrt[2], Sqrt[2]}
Regards,
Jean-Marc