import sympy


def vector_subs(expr, substitution_vec, replace_with):
    """Substitute vectors for vectors in sympy.

    Also support numpy substitution

    >>> x = Matrix([
        a + 2,
        b * b + 1
    ])

    >>> subs_targets = Matrix([
        a,
        b
    ])

    >>> subs_replacers = Matrix([
        1.0,
        c
    ])
    >>> print vector_subs(x, subs_targets, subs_replacers)
    >>> Matrix([
        3.0,
        (c ** 2) + 1.0
    ])
    """
    sub_dict = {k: v for k, v in zip(substitution_vec, replace_with)}
    substituted_expr = [v.subs(sub_dict) for v in expr]

    return sympy.Matrix(substituted_expr)