Re: domain restriction in NSolve does not work

• To: mathgroup at smc.vnet.net
• Subject: [mg128873] Re: domain restriction in NSolve does not work
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Sat, 1 Dec 2012 04:36:30 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net
• References: <20121130105645.775586898@smc.vnet.net>

```I believe that this capability was added starting with version 8.

NSolve[x^5 - 2 x + 3 == 0, x, Reals]

{{x -> -1.42361}}

Works on my Mac with either version 8 or 9. You can also use

Select[NSolve[x^5 - 2 x + 3 == 0, x],
FreeQ[#, Complex] &]

{{x -> -1.42361}}

Select[NSolve[x^5 - 2 x + 3 == 0, x],
Element[x /. #, Reals] &]

{{x -> -1.42361}}

Select[NSolve[x^5 - 2 x + 3 == 0, x],
Element[#[[1, -1]], Reals] &]

{{x -> -1.42361}}

Bob Hanlon

On Fri, Nov 30, 2012 at 5:56 AM,  <niieldo at googlemail.com> wrote:
> Dear all,
>
> I have encountered the problem that restricting domains in NSolve does not work.
> I get the same results for NSolve[x^5 - 2 x + 3 == 0, x, Reals] as with NSolve[x^5 - 2 x + 3 == 0, x], namely {{x -> -1.42361}, {x -> -0.246729 - 1.32082 I}, {x -> -0.246729 +
>     1.32082 I}, {x -> 0.958532 - 0.498428 I}, {x ->
>    0.958532 + 0.498428 I}}
>
> I.e. Mathematica actually does not apply the restriction.
>
> Does anyone have a solution for this? Do I have to adjust the settings somewhere?
>