Neither of these is what you want. subs just puts infinity in the expression and works it out from the bottom up, so it computes oo**3 - 3*oo, which comes out to oo - oo, which gives nan. evalf won't help either: it's use is for numerical evaluation, but numerical inf behaves the same way.
If you want to evaluate your expression at infinity correctly, or at any other singular point, you should use limit, which computes things symbolically: In [1]: limit(x**3 - 3*x, x, oo) Out[1]: ∞ Aaron Meurer On Tue, Dec 3, 2013 at 7:54 AM, Alexander Birukov <[email protected]> wrote: > > a = rule.evalf(subs={x: inter.end}) > a = rule.subs({x: inter.end}).evalf() > > quieston is why this 2 lines gives 2 different ways of calculation infinity? > > like I'd eval x**3 - 3*x, where x = +-oo. > > First line will give me exactly what I want: +-infinity, and the second one > will give me nan for both value. > > I'd like to use first line everytime, but fun thing: > > If I have -x-1 and will eval it for -oo, answer is -oo, for +oo -- +oo. The > second one evals it correctly. > > Why does it happen? > > -- > 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. > 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. For more options, visit https://groups.google.com/groups/opt_out.
