def FDBEul(currU, dW, FDMatSq, h, sigma): B = sp.eye(len(currU)) - 1j * sum(dW) * FDMatSq b = 1j * h nextU = spla.spsolve(B, currU + b * sf.cubicU(currU, sigma)) return nextU
def FDFEul(currU, dW, FDMatSq, h, sigma): A = sp.eye(len(currU)) + 1j * sum(dW) * FDMatSq b = 1j * h nextU = A.dot(currU) + b * sf.cubicU(currU, sigma) return nextU
def PSFEul(currU, dW, kSq, h, sigma): a = (1 - 1j * np.sum(dW) * kSq) b = 1j * h nextU = np.multiply(a, currU) + b * fft(sf.cubicU(ifft(currU), sigma)) return nextU
def PSExplExp(currU, dW, kSq, h, sigma): nextU = np.multiply(np.exp( -sum(dW) * 1j * kSq), currU) + 1j * h * np.multiply( np.exp(-sum(dW) * 1j * kSq), fft(sf.cubicU(ifft(currU), sigma))) return nextU
def PSBEul(currU, dW, kSq, h, sigma): a = 1 / (1 + 1j * np.sum(dW) * kSq) b = 1j * h / (1 + 1j * np.sum(dW) * kSq) nextU = np.multiply(a, currU) + np.multiply( b, fft(sf.cubicU(ifft(currU), sigma))) return nextU
def FDExplExp(currU, dW, FDMatSq, h, sigma): nextU = la.expm(1j * sum(dW) * FDMatSq).dot(currU + 1j * h * sf.cubicU(currU, sigma)) return nextU