MathGroup Archive 2006

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

Search the Archive

Re: want real solutions instead of complex ones


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