LLL

Pure sage implementation for obtaining the relevant matrix for detecting Z-linear relations between real numbers

def lindepmat(L,N): return matrix(ZZ,[[1 if i==j else 0 for i in [0..len(L)-1]] + [round(2^N*L[j])] for j in [0..len(L)-1]]) def lindep(L,N): return lindepmat(L,N).LLL()[0][:len(L)] 
       
#example use: N = 20 # we'll work with 20 binary digits L = [RealField(N)(a) for a in [1,pi,pi^2,zeta(2)]] M = lindepmat(L,N) 
       
       
[       1        0        0        0  1048576]
[       0        1        0        0  3294200]
[       0        0        1        0 10349040]
[       0        0        0        1  1724840]
M.LLL() 
       
[  0   0  -1   6   0]
[-59 -54  23   1 -24]
[-43  65 -16  -2 -88]
[-97  78 -15   0 128]
# approach using pari pari(L).lindep().list() 
       
[0, 0, 1, -6]