New Sum of Powers Log Function
03-30-2021, 08:35 PM
Post: #11
 Albert Chan Senior Member Posts: 1,897 Joined: Jul 2018
RE: New Sum of Powers Log Function
(03-30-2021 01:44 AM)Albert Chan Wrote:  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 ...

We could estimate the dropped term, and add it back.

Code:
def guess2(n,s):     t = -log(n+.5)     p = lambertw(t/s,-1) / t     s += 0.5**p/p     return lambertw(t/s,-1) / t - 1

Above estimated x has similar error as roughx(n,s), but twice as fast. (on my machine)

(03-30-2021 01:44 AM)Albert Chan Wrote:  Turns out, LambertW -1 branch is the one we need.

Illustrate the reason, by example:

>>> n, s = 100, 1000
>>> t = -log(n+.5)
>>> p = lambertw(t/s,-1) / t ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ # W1 resulted p
>>> p, (n+.5)**p/p, .5**p/p
(1.60037803179321, 1000.0, 0.2060704060225)
>>>
>>> p = lambertw(t/s, 0) / t ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ # W0 resulted p
>>> p, (n+.5)**p/p, .5**p/p
(0.00100464230172027, 1000.0, 994.686243766351)

Both solved p, for s = (n+.5)**p/p.
But, the assumption that last term can be dropped is false for W0
 « Next Oldest | Next Newest »

 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-29-2021, 10:47 PM RE: New Sum of Powers Log Function - Albert Chan - 03-30-2021, 01:44 AM RE: New Sum of Powers Log Function - Albert Chan - 03-30-2021 08:35 PM RE: New Sum of Powers Log Function - Albert Chan - 03-30-2021, 10:26 PM RE: New Sum of Powers Log Function - Namir - 03-30-2021, 11:05 AM RE: New Sum of Powers Log Function - Albert Chan - 03-30-2021, 04:35 PM RE: New Sum of Powers Log Function - Paul Dale - 03-30-2021, 11:41 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 - Albert Chan - 03-31-2021, 04:06 PM RE: New Sum of Powers Log Function - Albert Chan - 03-31-2021, 09:25 PM RE: New Sum of Powers Log Function - Namir - 03-31-2021, 02:19 PM RE: New Sum of Powers Log Function - Albert Chan - 04-01-2021, 02:56 PM RE: New Sum of Powers Log Function - Namir - 04-01-2021, 06:05 PM RE: New Sum of Powers Log Function - Albert Chan - 04-01-2021, 11:05 PM RE: New Sum of Powers Log Function - Namir - 04-01-2021, 11:55 PM RE: New Sum of Powers Log Function - Albert Chan - 04-02-2021, 01:29 AM RE: New Sum of Powers Log Function - Albert Chan - 04-02-2021, 01:18 PM RE: New Sum of Powers Log Function - Namir - 04-04-2021, 03:41 PM

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