Furthermore, I tried the original thing with gamma(n+1)/gamma(n/2+1)/ gamma(n/2+1)/2^n... that fails too, with "essential singularity" instead of "unfamiliar singularity". Even these fail:
sage: f = factorial(n) sage: g = factorial(n) / (n/e)^n sage: taylor(f, n, infinity, 2) sage: taylor(g, n, infinity, 2) Both fail with TypeError: ECL says: Error executing code in Maxima: taylor: encountered an essential singularity in: gamma(n+1) On Dec 28, 10: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 -- 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
