MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: want real solutions instead of complex ones

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66501] Re: want real solutions instead of complex ones
  • From: Peter Pein <petsie at dordos.net>
  • Date: Wed, 17 May 2006 03:29:41 -0400 (EDT)
  • References: <e4biic$175$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Nabeel Butt schrieb:
> Dear All,
>           I solve a system of 10 equations and get real solution along with
> complex ones.Is there a way such that I get only real solutions satisfying
> given constraints using NSolve.
> 
>    Find attached the file.
> 
>        regards,
> 
>         Nabeel Butt
> 
[snip]

Hi Nabeel,

allSoln={x,y}/.NSolve[...];
realSoln=Select[Chop[allSoln],Element[#,Reals]&]

should do what you want.

If you want to keep the rules in the solutions then use

allRules=NSolve[...];
realRules=Cases[allRules,{x->x0_,y->y0_}/;Element[Chop[{x0,y0}],Reals]]


Peter


  • Prev by Date: Fancy pictures in 3D
  • Next by Date: Re: what is K$
  • Previous by thread: want real solutions instead of complex ones
  • Next by thread: Re: want real solutions instead of complex ones