'Integrate Formal Power Series.
Examples
>>> from sympy import fps, sin
>>> from sympy.abc import x
>>> f = fps(sin(x))
>>> f.integrate(x).truncate()
-1 + x**2/2 - x**4/24 + O(x**6)
>>> f.integrate((x, 0, 1))
-cos(1) + 1'

def integrate(self, x=None):

    from sympy.integrals import integrate
    if (x is None):
        x = self.x
    elif iterable(x):
        return integrate(self.function, x)
    f = integrate(self.function, x)
    ind = integrate(self.ind, x)
    ind += (f - ind).limit(x, 0)
    pow_xk = self._get_pow_x(self.xk.formula)
    ak = self.ak
    k = ak.variables[0]
    if ak.formula.has(x):
        form = []
        for (e, c) in ak.formula.args:
            temp = S.Zero
            for t in Add.make_args(e):
                pow_x = self._get_pow_x(t)
                temp += (t / ((pow_xk + pow_x) + 1))
            form.append((temp, c))
        form = Piecewise(*form)
        ak = sequence(form.subs(k, (k - 1)), (k, (ak.start + 1), ak.stop))
    else:
        ak = sequence((ak.formula / (pow_xk + 1)).subs(k, (k - 1)), (k, (ak.start + 1), ak.stop))
    return self.func(f, self.x, self.x0, self.dir, (ak, self.xk, ind))
