Zero is essentially the reason. That's why the assumptions system doesn't remove the -sqrt(y) solution, because it could be nonnegative for nonnegative y. Neither solve() nor the assumptions system are smart enough to realize that that case is already handled by sqrt(y).
It's a similar problem to the side issue discussed at https://code.google.com/p/sympy/issues/detail?id=3852. Aaron Meurer On Thu, May 30, 2013 at 3:46 PM, Lucas Wilkins <[email protected]> wrote: > Hi, I've found some inappropriate behaviour of the solve function. > > >>> x,y = symbols("x y", real=True, nonnegative=True) > >>> solve(y-x**2,x) > [-sqrt(y), sqrt(y)] > > The only non-negative case where both sqrt(y) and -sqrt(y) should be > solutions is where y=0, in which case they are equal and not different after > all. It's quite annoying if there should be a single solution of zero! > > It should really work like positives: > > >>> x,y = symbols("x y", real=True, positive=True) > >>> solve(y-x**2,x) > [sqrt(y)] > > I didn't submit an issue because I was not sure if it was deliberate > (perhaps for making floats work properly?). > > :L > > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy?hl=en-US. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
