Post Reply 
New Sum of Powers Log Function
03-30-2021, 01:44 AM
Post: #4
RE: New Sum of Powers Log Function
(03-29-2021 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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
New Sum of Powers Log Function - Namir - 03-29-2021, 04:53 PM
RE: New Sum of Powers Log Function - C.Ret - 03-29-2021, 08:39 PM
RE: New Sum of Powers Log Function - Albert Chan - 03-30-2021 01:44 AM
RE: New Sum of Powers Log Function - Namir - 03-30-2021, 11:05 AM
RE: New Sum of Powers Log Function - Gene - 03-30-2021, 01:43 PM
RE: New Sum of Powers Log Function - C.Ret - 03-30-2021, 04:01 PM
RE: New Sum of Powers Log Function - Namir - 03-30-2021, 05:56 PM
RE: New Sum of Powers Log Function - Namir - 03-31-2021, 01:27 PM
RE: New Sum of Powers Log Function - Namir - 03-31-2021, 02:19 PM
RE: New Sum of Powers Log Function - Namir - 04-01-2021, 06:05 PM
RE: New Sum of Powers Log Function - Namir - 04-01-2021, 11:55 PM
RE: New Sum of Powers Log Function - Namir - 04-04-2021, 03:41 PM



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