'Evaluate the given formula to an accuracy of n digits.
Optional keyword arguments:
subs=<dict>
Substitute numerical values for symbols, e.g.
subs={x:3, y:1+pi}. The substitutions must be given as a
dictionary.
maxn=<integer>
Allow a maximum temporary working precision of maxn digits
(default=100)
chop=<bool>
Replace tiny real or imaginary parts in subresults
by exact zeros (default=False)
strict=<bool>
Raise PrecisionExhausted if any subresult fails to evaluate
to full accuracy, given the available maxprec
(default=False)
quad=<str>
Choose algorithm for numerical quadrature. By default,
tanh-sinh quadrature is used. For oscillatory
integrals on an infinite interval, try quad=\'osc\'.
verbose=<bool>
Print debug information (default=False)'

def evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False):

    from sympy import Float, Number
    n = (n if (n is not None) else 15)
    if (subs and is_sequence(subs)):
        raise TypeError('subs    must    be    given    as    a    dictionary')
    if ((n == 1) and isinstance(self, Number)):
        from sympy.core.expr import _mag
        rv = self.evalf(2, subs, maxn, chop, strict, quad, verbose)
        m = _mag(rv)
        rv = rv.round((1 - m))
        return rv
    if (not evalf_table):
        _create_evalf_table()
    prec = dps_to_prec(n)
    options = {'maxprec': max(prec, int((maxn * LG10))), 'chop': chop, 'strict': strict, 'verbose': verbose}
    if (subs is not None):
        options['subs'] = subs
    if (quad is not None):
        options['quad'] = quad
    try:
        result = evalf(self, (prec + 4), options)
    except NotImplementedError:
        v = self._eval_evalf(prec)
        if (v is None):
            return self
        try:
            result = evalf(v, prec, options)
        except NotImplementedError:
            return v
    (re, im, re_acc, im_acc) = result
    if re:
        p = max(min(prec, re_acc), 1)
        re = Float._new(re, p)
    else:
        re = S.Zero
    if im:
        p = max(min(prec, im_acc), 1)
        im = Float._new(im, p)
        return (re + (im * S.ImaginaryUnit))
    else:
        return re
