# hypercube.py -- the fully frustrated hypercube of Marinari, Parisi and Ritort, as an Ising array. # Signs on the edges of {0,1}^D, in the gauge J(x, x+e_nu) = (-1)^(x_1+...+x_{nu-1}); we check that all the square # faces are frustrated, and that the matrix W of couplings between the even and the odd vertices, of size 2^(D-1), # satisfies W W^t = D, i.e. is a weighing matrix of weight D. For D <= 5 we also compute the ground state energy # per spin, E/2^D = -max_b sum_j |(Wb)_j| / (sqrt(D) 2^D), to be compared with the bound -1/2, reached for D = 1, 4. import numpy as np, itertools from math import sqrt def coupling(D): J={} for x in range(2**D): for nu in range(D): if not (x>>nu)&1: s=(-1)**bin(x&((1<>mu)&1 and not (x>>nu)&1: y,z,w=x|(1<