Пример #1
0
def ftTest():

    w0 = 1.
    delta = .1
    tVec = np.linspace(-200., 200., 1000, endpoint=False)
    wVec = FT.wVecFromTVec(tVec)
    f = np.exp(1j * w0 * tVec - delta * np.abs(tVec))
    g = -1. / np.sqrt(2. * np.pi) * (1j / (wVec - w0 - 1j * delta) - 1j /
                                     (wVec - w0 + 1j * delta))

    wVec, gFT = FT.FT(tVec, f)

    fig, ax = plt.subplots(nrows=1, ncols=1)
    #ax.plot(wVec, np.real(g), color = 'blue', label="Analytical")
    #ax.plot(wVec, np.real(gFT), color = 'red', label="Numerical")
    ax.plot(wVec, np.real(gFT) - np.real(g), color='red', label="Diff")
    #ax.plot(tVec, np.real(f), color = 'red', label="f(t)")
    plt.legend()
    plt.show()

    failArr = (np.abs(g - gFT) > 0.1)

    if (np.any(failArr)):
        print(
            "Numerical FT is NOT consistent with analytical result!!! ------ CHECK FAILED!!!"
        )
        return False
    else:
        print(
            "Numerical FT is consistent with analytical result! ------ CHECK PASSED :)"
        )
        return True
Пример #2
0
def numGreenVecWLesser(kVec, wVec, eta, damping):
    tVec = FT.tVecFromWVec(wVec)
    tVecPos = tVec[len(tVec) // 2:]
    GFT = gfNumVecTLesser(kVec, tVecPos, eta, damping)
    GFZero = np.zeros((len(kVec), len(tVec) // 2), dtype='complex')
    GFT = np.concatenate((GFZero, GFT), axis=1)

    wVecCheck, GFW = FT.FT(tVec, GFT)

    return GFW
Пример #3
0
def anaGreenVecW(kVec, wVec, eta, damping):
    tVec = FT.tVecFromWVec(wVec)
    tVecPos = tVec[len(tVec) // 2:]
    GFT = anaGreenVecT(kVec, tVecPos, eta, damping)
    GFZero = np.zeros((len(kVec), len(tVec) // 2), dtype='complex')
    GFT = np.concatenate((GFZero, GFT), axis=1)

    wVecCheck, GFW = FT.FT(tVec, GFT)

    assert ((np.abs(wVec - wVecCheck) < 1e-10).all)
    return GFW
def expectationSinSinW(wVec, eta, damping):
    tVec = FT.tVecFromWVec(wVec)
    tVecPos = tVec[len(tVec) // 2:]
    expSinSinPos = expectationSinSin(tVecPos, eta)
    expSinSinPosTurned = expectationSinSinTurned(tVecPos, eta)
    expSinSinPos = -expSinSinPos + expSinSinPosTurned
    Zeros = np.zeros((len(tVec) // 2), dtype='complex')
    #expSinSin = np.concatenate((expSinSinPos, Zeros), axis=0)
    expSinSin = np.concatenate((Zeros, expSinSinPos), axis=0)
    dampingArr = np.exp(-damping * np.abs(tVec))
    expSinSinDamped = expSinSin * dampingArr

    wVecCheck, expSinSinW = FT.FT(tVec, expSinSinDamped)

    #gsT = - 2. / np.pi * prms.chainLength
    #fac = np.sqrt(1 - 2. * eta * eta / (prms.w0) * gsT)
    #return eta**2 / fac * (1j / (wVec - fac * prms.w0 + 1j * damping) - 1j / (wVec + fac * prms.w0 + 1j * damping))

    return expSinSinW * np.sqrt(2. * np.pi)