'Perform the integration using any hints given.
Examples
>>> from sympy import Integral
>>> from sympy.abc import x, i
>>> Integral(x**i, (i, 1, 3)).doit()
Piecewise((2, Eq(log(x), 0)), (x**3/log(x) - x/log(x), True))
See Also
sympy.integrals.trigonometry.trigintegrate
sympy.integrals.risch.heurisch
sympy.integrals.rationaltools.ratint
as_sum : Approximate the integral using a sum'

def doit(self, **hints):

    if (not hints.get('integrals', True)):
        return self
    deep = hints.get('deep', True)
    meijerg = hints.get('meijerg', None)
    conds = hints.get('conds', 'piecewise')
    risch = hints.get('risch', None)
    manual = hints.get('manual', None)
    if (conds not in ['separate', 'piecewise', 'none']):
        raise ValueError(('conds    must    be    one    of    "separate",    "piecewise",    "none",    got:    %s' % conds))
    if (risch and any(((len(xab) > 1) for xab in self.limits))):
        raise ValueError('risch=True    is    only    allowed    for    indefinite    integrals.')
    if self.is_zero:
        return S.Zero
    function = self.function
    if deep:
        function = function.doit(**hints)
    if function.is_zero:
        return S.Zero
    if isinstance(function, MatrixBase):
        return function.applyfunc((lambda f: self.func(f, self.limits).doit(**hints)))
    undone_limits = []
    ulj = set()
    for xab in self.limits:
        if (len(xab) == 1):
            uli = set(xab[:1])
        elif (len(xab) == 2):
            uli = xab[1].free_symbols
        elif (len(xab) == 3):
            uli = xab[1].free_symbols.union(xab[2].free_symbols)
        if ((xab[0] in ulj) or any(((v[0] in uli) for v in undone_limits))):
            undone_limits.append(xab)
            ulj.update(uli)
            function = self.func(*([function] + [xab]))
            factored_function = function.factor()
            if (not isinstance(factored_function, Integral)):
                function = factored_function
            continue
        def try_meijerg(function, xab):
            ret = None
            if ((len(xab) == 3) and (meijerg is not False)):
                (x, a, b) = xab
                try:
                    res = meijerint_definite(function, x, a, b)
                except NotImplementedError:
                    from sympy.integrals.meijerint import _debug
                    _debug('NotImplementedError    from    meijerint_definite')
                    res = None
                if (res is not None):
                    (f, cond) = res
                    if (conds == 'piecewise'):
                        ret = Piecewise((f, cond), (self.func(function, (x, a, b)), True))
                    elif (conds == 'separate'):
                        if (len(self.limits) != 1):
                            raise ValueError('conds=separate    not    supported    in    multiple    integrals')
                        ret = (f, cond)
                    else:
                        ret = f
            return ret
        meijerg1 = meijerg
        if ((len(xab) == 3) and xab[1].is_real and xab[2].is_real and (not function.is_Poly) and (xab[1].has(oo, (- oo)) or xab[2].has(oo, (- oo)))):
            ret = try_meijerg(function, xab)
            if (ret is not None):
                function = ret
                continue
            else:
                meijerg1 = False
        if ((meijerg1 is False) and (meijerg is True)):
            antideriv = None
        else:
            antideriv = self._eval_integral(function, xab[0], meijerg=meijerg1, risch=risch, manual=manual, conds=conds)
            if ((antideriv is None) and (meijerg1 is True)):
                ret = try_meijerg(function, xab)
                if (ret is not None):
                    function = ret
                    continue
        if (antideriv is None):
            undone_limits.append(xab)
            function = self.func(*([function] + [xab])).factor()
            factored_function = function.factor()
            if (not isinstance(factored_function, Integral)):
                function = factored_function
            continue
        elif (len(xab) == 1):
            function = antideriv
        else:
            if (len(xab) == 3):
                (x, a, b) = xab
            elif (len(xab) == 2):
                (x, b) = xab
                a = None
            else:
                raise NotImplementedError
            if deep:
                if isinstance(a, Basic):
                    a = a.doit(**hints)
                if isinstance(b, Basic):
                    b = b.doit(**hints)
            if antideriv.is_Poly:
                gens = list(antideriv.gens)
                gens.remove(x)
                antideriv = antideriv.as_expr()
                function = antideriv._eval_interval(x, a, b)
                function = Poly(function, *gens)
            else:
                def is_indef_int(g, x):
                    return (isinstance(g, Integral) and any(((i == (x,)) for i in g.limits)))
                def eval_factored(f, x, a, b):
                    args = []
                    for g in Mul.make_args(f):
                        if is_indef_int(g, x):
                            args.append(g._eval_interval(x, a, b))
                        else:
                            args.append(g)
                    return Mul(*args)
                (integrals, others) = ([], [])
                for f in Add.make_args(antideriv):
                    if any((is_indef_int(g, x) for g in Mul.make_args(f))):
                        integrals.append(f)
                    else:
                        others.append(f)
                uneval = Add(*[eval_factored(f, x, a, b) for f in integrals])
                try:
                    evalued = Add(*others)._eval_interval(x, a, b)
                    function = (uneval + evalued)
                except NotImplementedError:
                    undone_limits.append(xab)
                    function = self.func(*([function] + [xab]))
                    factored_function = function.factor()
                    if (not isinstance(factored_function, Integral)):
                        function = factored_function
    return function
