Re: How to count
- To: mathgroup at smc.vnet.net
- Subject: [mg125812] Re: How to count
- From: danl at wolfram.com
- Date: Tue, 3 Apr 2012 04:51:05 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jl14ig$l5e$1@smc.vnet.net> <jl3uuf$3kp$1@smc.vnet.net> <jl90l4$mpf$1@smc.vnet.net>
On Sunday, April 1, 2012 2:38:12 AM UTC-5, Costa Bravo wrote: > Daniel Lichtblau Wolfram Research > > > bottom = 100000; > > Timing[bb = Table[Ceiling[Exp[LogGamma[N[n+1,n]]/2]], > > {n,bottom,10*bottom,bottom}];] > > > > Out[16]= {671.196962, Null} > > My computer needs more time > {1256.916, Null} > > Let's test a better solution > > n = 100000; > {Timing[lg2 = Exp[LogGamma[N[n + 1, n]]/2];], Precision[lg2]} > {Timing[lg2 = N[Exp[LogGamma[n + 1]/2], n];], Precision[lg2]} > {Timing[lg2 = Exp[N[LogGamma[n + 1]/2, n]];], Precision[lg2]} > > {{9.048, Null}, 556568.58} > > {{3.338, Null}, 100000.} > > {{0.593, Null}, 99994.11} (* !!! *) > > surprising result for n = 1 000 000 > > n = 1000000; > {Timing[lg2 = Exp[LogGamma[N[n + 1, n]]/2];], Precision[lg2]} > {Timing[lg2 = N[Exp[LogGamma[n + 1]/2], n];], Precision[lg2]} > {Timing[lg2 = Exp[N[LogGamma[n + 1]/2, n]];], Precision[lg2]} > > {{218.557, Null}, 6.5657032*10^6} > > {{217.528, Null}, 1.*10^6} (* !!! *) > > {{27.877, Null}, 999993.19} > > The new version of the original expression > > bottom = 10^5; > Timing[bb1 = > Table[Ceiling[Exp[N[LogGamma[n + 1]/2, n]]], {n, bottom, 10*bottom, > bottom}];] > > {126.034, Null} > > 10 times faster !! > > -- > Costa Nice ketch. Daniel Lichtblau Wolfram Research