def _subs(expr, X, X_subs):
    """helper function for multiple substitutions
    expr is the expression whose variables are to be substituted
    X is a list or Matrix with the regarded variables in order
    X_subs are the new values in order
    """
    i = 0
    while i < len(X):
        expr = expr.subs(X[i], X_subs[i])
        i += 1
    return expr