Re: Real Solutions
- To: mathgroup at smc.vnet.net
- Subject: [mg95830] Re: Real Solutions
- From: dimitris <dimmechan at yahoo.com>
- Date: Wed, 28 Jan 2009 06:31:19 -0500 (EST)
- References: <glmssi$mkr$1@smc.vnet.net>
On 27 =CE=99=CE=B1=CE=BD, 13:58, Kowalczyk-Schr=C3=B6der wrote:
> Hi,
> I need only the real solutions from Solve or NSolve. I found a
> complicated way with a lot of "ifs" to get, what I want. Is there an
> easier way to do this? (I don't want to use Reduce.)
> Regards
> J.Schroeder
Something like
In[75]:=
x /. Solve[x^4 + x^3 + x^2 + 2*x + 1 == 0, x]
Select[%,Element[#,Reals] & ]
Out[75]=
{-1, -(2/(3*(-9 + Sqrt[93])))^(1/3) + ((1/2)*(-9 + Sqrt[93]))^(1/3)/3^
(2/3),
-(((1 + I*Sqrt[3])*((1/2)*(-9 + Sqrt[93]))^(1/3))/(2*3^(2/3))) + (1
- I*Sqrt[3])/(2^(2/3)*(3*(-9 + Sqrt[93]))^(1/3)),
-(((1 - I*Sqrt[3])*((1/2)*(-9 + Sqrt[93]))^(1/3))/(2*3^(2/3))) + (1
+ I*Sqrt[3])/(2^(2/3)*(3*(-9 + Sqrt[93]))^(1/3))}
Out[76]=
{-1, -(2/(3*(-9 + Sqrt[93])))^(1/3) + ((1/2)*(-9 + Sqrt[93]))^(1/3)/3^
(2/3)}