I'm learning series and I wanted to check myself, whether or not I've done 
correct convergence test. I have this series:
((n-1)/(n+1))**(n**2)
I applied function summation and got nothing. But in fact this series 
converges, I checked that with ratio test.

So I decided to write function that implements ration test. It's quite 
simple (draft) function. I assumed that series depends on variable n (I 
didn't find way to find function arguments, I think I can do it with 
something like recursive calls of method args, but I'm not sure). Here it 
is:

def ratio_test(series, x=n):
    """Ratio test for testing series convergence"""
    ratio_limit = abs((series.subs(x, n + 1)/series.subs(x, n)).limit(n, 
oo))
    if ratio_limit < 1:
        return True
    elif ratio_limit == 0:
        return None
    elif ratio_limit > 1:
        return False

Tests:
a_n = (((n-1)/(n+1))**(n**2))
ratio_test(a_n)
Out: True

b_n = z**n/factorial(n)
ratio_test(b_n)
Out: True

c_n = factorial(n)*z**n
ratio_test(c_n)
Out: True

d_n = 1/n
ratio_test(d_n)
Out: None

e_n = t/(exp(t))
ratio_test(e_n, t)
Out: True

Should I contribute and put those functions for example in series module?

-- 
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