functionmaximanumerical-computing

How to compute Brjuno function in Maxima CAS?


I try to compute real 1-Brjuno function for real numbers in x in [0, 1] range

  G(x):= block(
            [g],
        if (x=0) 
            then g : 0
            else g : float(1/x - floor(1/x)),
        return( g)
        )$
    
   bet(j,x) := block(
        [r],
        if (j=-1) 
            then r:1
            else r : product (G(x)^i, i, 0, j),
        return( r)
        )$
    
    A(i,x) := bet(i-1,x)*log(1/G(x)^i)$
    B(x):= sum(A(i,x), i, 0,10)$
    

There are numerical errors :

                        0
    expt: undefined: 0.0

caused by A function for some x values : 1/2,1/5,1/10,1/3,1/9,1/4,0

How can I solve this problem ?


Solution

  • This produces a plot similar to the paper. I used an equation from wikipedia and a continued fraction approximation:

    cflength: 10 $
    B(x):= if length(x)=1 then 0 else (local(x), x[1]: 0, -log(cf2num(x))+cf2num(x)*B(rest(x))) $
    cf2num(e):=ev(cfdisrep(e), numer, infeval) $
    x0: makelist(i*sqrt(2)/1421, i, 1, 1000), numer $
    x: map(cf, x0) $
    y: map(B, x) $
    draw2d(points(x0, y)) $
    

    enter image description here