You need to use real_root, like In [3]: real_root(-1, 3) Out[3]: -1
In [4]: real_root(-1, 3)**2 Out[4]: 1 SymPy, like most math libraries, uses complex roots (i.e., principal roots) because they have nicer mathematical properties. Aaron Meurer On Wed, Nov 4, 2015 at 3:30 AM, Paul Royik <distantjob...@gmail.com> wrote: > I have the following expresssion: > > f=x**(Rational(2,3)) > > How can I get 1, when substituting (-1) instead of complex number? > For now, I got complex number when run f.subs(x,-1).evalf() > > -- > 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 sympy+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > 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/662a2085-1030-42d5-bbde-feb524fd246c%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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. 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/CAKgW%3D6Lr7W1vdS8NXD8ntkz6wxndyh-Nniz_9V0c7uNQeLmR-Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.