<jupyter_start><jupyter_text>$\chi(\vec{q}) =\frac{1}{N}\sum_k^N \frac{fd(\xi_k)-fd(\xi_{k+q})}{\xi_{k}-\xi_{k+q}}$<jupyter_code>def fd(e,T):
    return 1/(1+np.exp(e/T))
for t in [1e-5,1e-1,1,2]:
    plt.plot(E(kk,mu=2),fd(E(kk,mu=2),t))
def suscep(q,k,mu,T):
        num = fd(E(k,mu),T)-fd(E(k+q,mu),T)
        den = E(k,mu)-E(k+q,mu)
        res = num/den
        av = np.average(res)
        return av
sus1 = [suscep(q,kk,mu=2,T=0.01) for q in kk]
sus2 = [suscep(q,kk,mu=2,T=0.2) for q in kk]
sus01 = [suscep(q,kk,mu=2,T=0.1) for q in kk]
plt.plot(k,sus01)
plt.plot(k,sus1)
plt.plot(k,sus2)
xy = np.array([ [x,y] for x in kk for y in kk])
def E2(x,y,mu):
    return -np.cos(x)-np.cos(y)-mu
plt.scatter(xy.T[0],xy.T[1],c=E2(xy.T[0],xy.T[1],0),cmap='jet')
plt.axis('equal')
plt.colorbar()
def suscep2(q,k,mu,T):
        num = fd(E2(k.T[0],k.T[1],mu),T)-fd(E2(k.T[0]+q.T[0],k.T[1]+q.T[1],mu),T)
        den = E2(k.T[0],k.T[1],mu)-E2(k.T[0]+q.T[0],k.T[1]+q.T[1],mu)
        res = num/den
        av = np.average(res)
        return av
sus2d01 = [suscep2(q,xy,mu=0,T=0.01) for q in xy]
sus2d1 = [suscep2(q,xy,mu=0,T=0.1) for q in xy]
plt.scatter(xy.T[0],xy.T[1],c=sus2d01,cmap='jet')
plt.colorbar()
plt.scatter(xy.T[0],xy.T[1],c=sus2d1,cmap='jet')
plt.colorbar()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup