Post Reply 
Estimate logarithm quickly
11-26-2021, 06:24 PM (This post was last modified: 09-16-2024 12:21 AM by Albert Chan.)
Post: #14
RE: Estimate logarithm quickly
(11-20-2021 02:02 PM)Albert Chan Wrote:  |ln(n)| (n-1) / ((1 + 4*√n + n)/6) // Simpson's Rule

A simpler proof of inequality is convert it to atanh(y)
Assume x>1, then y = (x-1)/(x+1) > 0

To avoid square mess, we apply Doerfler's formula with squared argument.
ln(x) = atanh(y = (x-1)/(x+1))*2       → atanh(y) = ln(x = (1+y)/(1-y))/2

XCAS> D2(x) := 3*(x*x-1)/(1 + 4*x + x*x)
XCas> factor(D2((1+y)/(1-y)) /2)       → -3*y/(-3+y^2)

This is just pade(atanh(y),y,4,2), which expands to:

y/(1-y^2/3) = y + y^3/3 + y^5/3² + y^7/3³ + ...

For y>0, atanh(y) = y + y^3/3 + y^5/5 + y^7/7 + ... is bigger.
For x>1, ln(x), which atanh(y) were derived from, is biggger than D2(x)

Because of symmetry, For 0<x<1, D2(x) = -D2(1/x), same as ln(x).
Thus the proof can be extended from x > 1, to x > 0

XCAS> D2(2), D2(1/2)       → (9/13 , -9/13)



We can use above ln(n) estimate for atanh(x) = 1/2 * ln((1+x)/(1-x))

atanh(x)/x ≥ 3/(1 + 2*sqrt(1-x*x))

Cas> series((atanh(x)/x) / (3/(1+2*sqrt(1-x*x))), x, 0, 9, polynom)

1 + 1/180*x^4 + 17/2520*x^6 + 139/20160*x^8

Since i^4=1, inequality hold even if x is purely imaginery! (x → x*i, and simplify)

atan(x)/x ≥ 3/(1 + 2*sqrt(1+x*x))

lua> y, x = 0.75, 0.5

lua> atanh(x)/x, 3/(1+2*sqrt(1-x*x))
1.0986122886681096      1.098076211353316
lua> atanh(y)/y, 3/(1+2*sqrt(1-y*y))
1.2972734327035422      1.2915026221291812

lua> atan(x)/x, 3/(1+2*sqrt(1+x*x))
0.9272952180016122      0.9270509831248422
lua> atan(y)/y, 3/(1+2*sqrt(1+y*y))
0.8580014783910458      0.8571428571428571

Convergence is from 1 side, with estimate not as good for bigger y.
We can compare ratio for y ≥ x > 0, using RHS numbers.

lua> (atanh(y)/y) / (atanh(x)/x) >= (1+2*sqrt(1-x*x)) / (1+2*sqrt(1-y*y))
true
lua> (atan(y)/y) / (atan(x)/x) >= (1+2*sqrt(1+x*x)) / (1+2*sqrt(1+y*y))
true
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Estimate logarithm quickly - Albert Chan - 08-21-2021, 03:39 PM
RE: Estimate logarithm quickly - trojdor - 08-21-2021, 06:31 PM
RE: Estimate logarithm quickly - EdS2 - 08-23-2021, 06:44 AM
RE: Estimate logarithm quickly - Albert Chan - 11-26-2021 06:24 PM
RE: Estimate logarithm quickly - klesl - 04-26-2022, 05:52 PM
RE: Estimate logarithm quickly - vaklaff - 04-28-2022, 04:33 PM
RE: Estimate logarithm quickly - klesl - 04-28-2022, 05:02 PM



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