def METHOD_NAME(self, psi, alpha, beta, gamma, chi, p, i):
    # backward substitution
    for j in reversed(range(i + 1)):
        chi[j] = (alpha[j] - np.dot(beta[j, j + 1 : i + 1], chi[j + 1 : i + 1])) / gamma[j]
    for j in range(i + 1):
        psi += chi[j] * p[j]