login
Continued fraction expansion of the value (mod 1) where ?(x)-x attains its global maximum.
0

%I #14 Oct 21 2024 20:24:44

%S 0,1,3,1,4

%N Continued fraction expansion of the value (mod 1) where ?(x)-x attains its global maximum.

%C ?(x) is Minkowski's question mark function. Note ?(x)-x is odd and has period 1. Finding the maximum of ?(x)-x difficult; fractal local maxima abound. Given that this continued fraction expansion represents the real a, we note the global minimum of ?(x)-x occurs (symmetrically across x=1/2) at 1-a (mod 1). We expect even entries will remain near (if not at) 1 and odd entries will grow very slowly (perhaps not monotonically).

%C A lookahead algorithm scanning over continued fractions with coefficients <= 20 and lookahead depth 4 returns the fraction [0; 1, 3, 1, 4, 1, 4, 1, 5, 1, 4, 1, 4, 1, 4, 1, 4, ..]. This corresponds to an x value of 0.7928941486060[1], at which point ?(x)-x is equal to 0.1425907067997[2]. - _Charlie Neder_, Oct 27 2018

%H <a href="/index/Me#MinkowskiQ">Index entries for Minkowski's question mark function</a>

%H <a href="/index/Me#MinkowskiQ">Index entries for sequences related to Minkowski's question mark function</a>

%e a = [0;1,3,1,4,..?..]

%o (Python)

%o from itertools import product

%o def qx(arr): #given continued fraction,

%o qx = 0

%o for i in range(1, len(arr)): #generate ?(x)/2

%o qx += (-1)**(i+1) / 2**sum(arr[:i+1])

%o ratio = arr[-1]

%o for i in range(len(arr)-2, -1, -1): #generate x

%o ratio = arr[i] + 1/ratio

%o return 2*qx - ratio, ratio #subtract

%o arr = [0, 1]

%o for k in range(1, 19):

%o cap = [0, ()] #current best branch

%o for tag in product(range(1, 21), repeat=4):

%o res = qx(arr + list(tag)) #test a branch, record if best

%o if res[0] > cap[0]: cap = [res[0], tag, res[1]]

%o print(cap) #print current ?(x)-x, best branch, current x

%o arr.append(cap[1][0]) #go down the branch

%o # _Charlie Neder_, Oct 27 2018

%K cofr,hard,more,nonn,changed

%O 0,3

%A Joseph Biberstine (jrbibers(AT)indiana.edu), Jun 13 2006