On Dec 28, 6:26 am, shreevatsa <[email protected]> wrote:
> Hi,
>
> I'm trying to use Sage to find the asymptotics of binomial
> coefficients. Specifically, I wanted to find out the rate at which
> binomial(n, n/2)/2^n goes down to 0 as n goes to infinity.
>
> See Wolfram 
> Alpha:http://www.wolframalpha.com/input/?i=%28n+choose+n%2F2%29+%2F+2%5En
> which gives a "series expansion at n=∞" from which (with some manual
> work) we can find out that it is
> sqrt(2/pi) * 1/n^(1/2)  - 1/(2*sqrt(2*pi)) * 1/n^(3/2) + O(1/n^(5/2)).
> (and presumably Mathematica does what Wolfram Alpha does too).
>
> How to do the same thing in Sage?
>
> I tried this:
>
>     sage: var('n')
>     n
>     sage: f = binomial(n, n/2) / 2^n
>     sage: f(n = 4)
>     3/8
>     sage: taylor(f, n, infinity, 2)
>
> ---------------------------------------------------------------------------
>     TypeError                                 Traceback (most recent
> call last)
>     ...
>     [snip]
>     ...
>     TypeError: ECL says: Error executing code in Maxima: taylor:
> encountered an unfamiliar singularity in:
>     binomial(n,n/2)
>
> Next, trying the trick 
> athttp://doxdrum.wordpress.com/2011/02/19/sage-tip-series-expansion/
> I tried changing n to 1/n:
>
>     sage: g = binomial(1/n, 1/(2*n)) / 2^(1/n)
>     sage: g(n = 1/4)
>     3/8
>     sage: taylor(g, n, 0, 2)
>
> ---------------------------------------------------------------------------
>     TypeError                                 Traceback (most recent
> call last)
>     ...
>     [snip]
>     ...
>     TypeError: ECL says: Error executing code in Maxima: taylor:
> encountered an unfamiliar singularity in:
>     binomial(1/n,1/(2*n))
>
> Same results. Incidentally, "taylor(f, n, 0, 2)" works, but "taylor(g,
> n, infinity, 2)" doesn't. I've also tried the same with binomial(2*n,
> n) and binomial(2/n, 1/n), and even with binomial(2*n*n, n*n) and
> binomial(2/(n*n), 1/(n*n)) (for which Wolfram Alpha sort of gives a
> power series in n instead of sqrt(n)), but the same results.
>
> Is there a way of getting the asymptotics of this function in Sage?
>
> Thanks,
> Shreevatsa


#NO GUARANTEE OF VALIDITY#
sage: from sympy import *
sage: n=symbols('n',integer=True)
sage: f=binomial(n,n/2)/2**n
sage: g=f.series(n,oo,3);g
pi**2*n**2*exp(-n*log(2))/24 + exp(-n*log(2)) + O(n**3)
#I think should be O(1/n**3)
sage: g1=g.removeO()
sage: limit(g1,n,oo)
0

-- 
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/sage-support
URL: http://www.sagemath.org

Reply via email to