Hi Richard, I do get your point that we don't have to make the same mistake with other systems, but I do think there is a benefit for consistency, if they have a purpose in doing that design. For most systems, sqrt() returns the principal/positive square root, so there is only one unique value. If we'd like a function to return all square roots, we can create another function dedicated to do that with a new name.
My two cents, Shawn On Friday, December 5, 2014 6:48:32 PM UTC-5, Richard Fateman wrote: > > You are heading into erroneous waters. > It doesn't matter that 3>0. sqrt(9) has two values, +3 and -3. > Just because some other systems make this mistake does not mean > sympy should do this. > > If you want to say something about the choice of branch for sqrt(x^2), > you have to say something about sqrt(x^2), not x. > > It may be sensible if you mean to restrict the square root function. > But not that way. > Good luck > > > On Friday, December 5, 2014 1:49:35 PM UTC-8, Aaron Meurer wrote: >> >> They need to be positive. Even for integer x, sqrt(x**2) != x if x is >> negative. >> >> Aaron Meurer >> >> On Fri, Dec 5, 2014 at 3:34 PM, Francesco Bonazzi >> <[email protected]> wrote: >> > newvars =symbols('x a b', integer=True) >> > e.xreplace(dict(zip([x,a,b], newvars))) >> > >> > I did not test this. >> > >> > -- >> > 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. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/75aa630a-4b0e-46b0-ac20-0f4ffff34f28%40googlegroups.com. >> >> >> > For more options, visit https://groups.google.com/d/optout. >> > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/74868c3f-1cfb-41df-9c20-4c2c6b1fbb04%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
