human
Complete this python program:
def _linear_neq_order1_type1(match_):
assistant
#Here is the Python code you requested.

    """System of n first-order constant-coefficient linear nonhomogeneous differential equation
    .. math:: y\_k = a_{k1} y_1 + a_{k2} y_2 +...+ a_{kn} y_n; k = 1,2,...,n
    or that can be written as `\vec{y\} = A . \vec{y}`
    where `\vec{y}` is matrix of `y_k` for `k = 1,2,...n` and `A` is a `n \times n` matrix.
    Since these equations are equivalent to a first order homogeneous linear
    differential equation. So the general solution will contain `n` linearly
    independent parts and solution will consist some type of exponential
    functions. Assuming `y = \vec{v} e^{rt}` is a solution of the system where
    `\vec{v}` is a vector of coefficients of `y_1,...,y_n`. Substituting `y` and
    `y\ = r v e^{r t}` into the equation `\vec{y\} = A . \vec{y}`, we get
    .. math:: r \vec{v} e^{rt} = A \vec{v} e^{rt}
    .. math:: r \vec{v} = A \vec{v}
    where `r` comes out to be eigenvalue of `A` and vector `\vec{v}` is the eigenvector
    of `A` corresponding to `r`. There are three possiblities of eigenvalues of `A`
    - `n` distinct real eigenvalues
    - complex conjugate eigenvalues
    - eigenvalues with multiplicity `k`
    1. When all eigenvalues `r_1,..,r_n` are distinct with `n` different eigenvectors
    `v_1,...v_n` then the solution is given by
    .. math:: \vec{y} = C_1 e^{r_1 t} \vec{v_1} + C_2 e^{r_2 t} \vec{v_2} +...+ C_n e^{r_n t} \vec{v_n}
    where `C_1,C_2,...,C_n` are arbitrary constants.
    2. When some eigenvalues are complex then in order to make the solution real,
    we take a llinear combination: if `r = a + bi` has an eigenvector
    `\vec{v} = \vec{w_1} + i \vec{w_2}` then to obtain real-valued solutions to
    the system, replace the complex-valued solutions `e^{rx} \vec{v}`
    with real-valued solution `e^{ax} (\vec{w_1} \cos(bx) - \vec{w_2} \sin(bx))`
    and for `r = a - bi` replace the solution `e^{-r x} \vec{v}` with
    `e^{ax} (\vec{w_1} \sin(bx) + \vec{w_2} \cos(bx))`
    3. If some eigenvalues are repeated. Then we get fewer than `n` linearly
    independent..."""
    eq = match_['eq']
    func = match_['func']
    fc = match_['func_coeff']
    n = len(eq)
    t = list(list(eq[0].atoms(Derivative))[0].atoms(Symbol))[0]
    constants = numbered_symbols(prefix='C', cls=Symbol, start=1)
    M = Matrix(n, n, (lambda i, j: (- fc[(i, func[j], 0)])))
    evector = M.eigenvects(simplify=True)
    def is_complex(mat, root):
        return Matrix(n, 1, (lambda i, j: ((re(mat[i]) * cos((im(root) * t))) - (im(mat[i]) * sin((im(root) * t))))))
    def is_complex_conjugate(mat, root):
        return Matrix(n, 1, (lambda i, j: ((re(mat[i]) * sin((abs(im(root)) * t))) + (((im(mat[i]) * cos((im(root) * t))) * abs(im(root))) / im(root)))))
    conjugate_root = []
    e_vector = zeros(n, 1)
    for evects in evector:
        if (evects[0] not in conjugate_root):
            if (len(evects[2]) != evects[1]):
                var_mat = Matrix(n, 1, (lambda i, j: Symbol(('x' + str(i)))))
                Mnew = ((M - (evects[0] * eye(evects[2][(-1)].rows))) * var_mat)
                w = [0 for i in range(evects[1])]
                w[0] = evects[2][(-1)]
                for r in range(1, evects[1]):
                    w_ = (Mnew - w[(r - 1)])
                    sol_dict = solve(list(w_), var_mat[1:])
                    sol_dict[var_mat[0]] = var_mat[0]
                    for (key, value) in sol_dict.items():
                        sol_dict[key] = value.subs(var_mat[0], 1)
                    w[r] = Matrix(n, 1, (lambda i, j: sol_dict[var_mat[i]]))
                    evects[2].append(w[r])
            for i in range(evects[1]):
                C = next(constants)
                for j in range((i + 1)):
                    if evects[0].has(I):
                        evects[2][j] = simplify(evects[2][j])
                        e_vector += ((((C * is_complex(evects[2][j], evects[0])) * (t ** (i - j))) * exp((re(evects[0]) * t))) / factorial((i - j)))
                        C = next(constants)
                        e_vector += ((((C * is_complex_conjugate(evects[2][j], evects[0])) *...