def barycentric_to_cartesian(bary, vertices):
    """
    Compute the Cartesian coordinates of a point with given barycentric coordinates.

    :param bary: The barycentric coordinates.
    :param vertices: The triangle vertices (3 by n matrix with the vertices as rows (where n is the dimension of the
        space)).
    :returns: The Cartesian coordinates vector.
    :rtype: n-dimensional vector
    """
    return vertices[0] * bary[0] + vertices[1] * bary[1] + vertices[2] * bary[2]