New Sum of Powers Log Function

03302021, 01:44 AM
Post: #4




RE: New Sum of Powers Log Function
(03292021 10:47 PM)Albert Chan Wrote: Since sum(k, k=1..n) = (n²+n)/2, a guess for x is log(s)/log(n)  1 If we have LambertW, we can get a much better guess, without solver. s ≈ ∫(t^x, t=1/2 .. n+1/2) = (n+1/2)^(x+1)/(x+1)  (1/2)^(x+1)/(x+1) If we drop the last term, and let N=n+1/2, X=x+1, we have s = N^X / X ln(s) = X*ln(N)  ln(X) We wanted to match W(a) = z → a = z * e^z → ln(a) = z + ln(z) ln(1/s) = X*ln(1/N) + ln(X) ln(1/s*ln(1/N)) = X*ln(1/N) + ln(X*ln(1/N)) → X = W(ln(1/N)/s) / ln(1/N) = W(ln(N)/s) / ln(N) Turns out, LambertW 1 branch is the one we need. Lets' try this out, for s = Σ(k, k=1 .. n) >>> guessx = lambda n,s: lambertw(ln(n+.5)/s,1) / log(n+.5)  1 >>> for n in range(1000,5001,1000): ... s = n*(n+1)/2 ... print n, log(s)/log(n)1, guessx(n,s) ... 1000 0.899801360605113 0.999999961026799 2000 0.908873017486397 0.99999999120301 3000 0.913467137635656 0.999999996300753 4000 0.916458516421875 0.999999997995799 5000 0.918641366353455 0.999999998752945 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)