expr1 = parse_expr('x**3 - 3*x')
expr2 = parse_expr('-x-1')

print(expr1.subs({x: p_infinity}).evalf())
print(expr1.evalf(subs={x: p_infinity}))
print(expr2.subs({x: p_infinity}).evalf())
print(expr2.evalf(subs={x: p_infinity}))

output:
nan
+inf
-inf
+inf


Question was why method subs and arg subs in evalf() work different for 
+-oo.


Anyway, thanks for the tip with limits. Works great.

среда, 4 декабря 2013 г., 22:11:31 UTC+4 пользователь Aaron Meurer написал:
>
> I just checked evalf and it returns the right answers, inf and -inf. 
> So apparently it's smarter than I had thought. 
>
> Aaron Meurer 
>
> On Wed, Dec 4, 2013 at 5:04 AM, Sergey Kirpichev 
> <[email protected]<javascript:>> 
> wrote: 
> > 
> > On Wednesday, December 4, 2013 7:13:09 AM UTC+4, Aaron Meurer wrote: 
> >> 
> >> evalf won't help 
> >> either: it's use is for numerical evaluation, but numerical inf 
> >> behaves the same way. 
> > 
> > 
> > Are you sure that evalf isn't broken here? 
> > 
> > 
> > -- 
> > 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] <javascript:>. 
> > To post to this group, send email to [email protected]<javascript:>. 
>
> > 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.

Reply via email to