Compare two expressions after evaluation of symbols by random expressions

    private function called by `sympy_empirical_equal`

    :param expr1: a first sympy expression
    :param expr2: a second sympy expression
    :param atoms: the component symbols (they are assumed to be common)
    :param vals: the values to subtitute atoms with
    :return: True if the result is the same

def _eval_res_equal(expr1, expr2, atoms, vals,threshold=10e-10):

    """
    Compare two expressions after evaluation of symbols by random expressions

    private function called by `sympy_empirical_equal`

    :param expr1: a first sympy expression
    :param expr2: a second sympy expression
    :param atoms: the component symbols (they are assumed to be common)
    :param vals: the values to subtitute atoms with
    :return: True if the result is the same
    """
    substitution_pairs = zip(atoms, vals)

    eval_1 = substitute_all(expr1, substitution_pairs)
    eval_2 = substitute_all(expr2, substitution_pairs)

    return abs(eval_1 - eval_2) < threshold