Apply ``substitute`` to all elements of an array ``a`` and return the resulting array.

    :param Union[np.array,List] a: The expression array to substitute.
    :param Dict[Parameter,Union[int,float]] d: Numerical substitutions for parameters.
    :return: An array of partially substituted Expressions or numbers.
    :rtype: np.array

def substitute_array(a, d):
    """
    Apply ``substitute`` to all elements of an array ``a`` and return the resulting array.

    :param Union[np.array,List] a: The expression array to substitute.
    :param Dict[Parameter,Union[int,float]] d: Numerical substitutions for parameters.
    :return: An array of partially substituted Expressions or numbers.
    :rtype: np.array
    """
    a = np.asarray(a, order="C")
    return np.array([substitute(v, d) for v in a.flat]).reshape(a.shape)