Comment #1 on issue 3223 by [email protected]: degree((x+1)**10000) takes too long
http://code.google.com/p/sympy/issues/detail?id=3223

as_leading_term is your workhorse:

eq=(x+1)**10000
eq.as_leading_term(x)
1
eq.subs(x,1/x).as_leading_term(x).subs(x, 1/x)
x**10000
((2*x+1)**100).subs(x,1/x).as_leading_term(x).subs(x, 1/x)
1267650600228229401496703205376*x**100

If you only want the degree, try:

def degree(e, x):
    return -e.subs(x, 1/x).leadterm(x)[1]


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to