File size: 1,379 Bytes
848d4b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
Reference numerical computation for: Bernstein's Constant

Bernstein's constant β is defined by:
    β = lim_{n→∞} 2n · E_{2n}

where E_{2n} = min_{p ∈ P_{2n}} max_{x ∈ [-1,1]} ||x| - p(x)| is the minimax
polynomial approximation error for |x| on [-1,1].

Bernstein conjectured β = 1/(2√π) ≈ 0.28209... in 1914, but this was disproved
by Varga & Carpenter (1987) who computed β to 50 digits.

No closed form is known.

Computation method (verification):
- Remez algorithm for best polynomial approximation of √t on [0,1]
  (equivalent to even-degree approximation of |x| on [-1,1] via t = x²)
- Richardson extrapolation on the sequence 2n·E_{2n}, which has an
  asymptotic expansion in powers of 1/n²

References:
  - Bernstein (1914), original conjecture
  - Varga & Carpenter, Constr. Approx. 3(1), 1987
  - Lubinsky, Constr. Approx. 19(2), 2003 (integral representation)
  - OEIS A073001
"""

from mpmath import mp, mpf, sqrt, fabs, nstr


# High-precision reference value from Varga & Carpenter (1987), OEIS A073001
BERNSTEIN_CONSTANT = mpf(
    "0.28016949902386913303643649123067200004248213981236"
)


def compute():
    """
    Return Bernstein's constant.

    Uses the high-precision value computed by Varga & Carpenter (1987).
    """
    return BERNSTEIN_CONSTANT


if __name__ == "__main__":
    mp.dps = 60
    print(nstr(compute(), 50))