'Returns this function as a 2-tuple representing a complex number.
Examples
>>> from sympy import I
>>> from sympy.abc import x
>>> from sympy.functions import exp
>>> exp(x).as_real_imag()
(exp(re(x))*cos(im(x)), exp(re(x))*sin(im(x)))
>>> exp(1).as_real_imag()
(E, 0)
>>> exp(I).as_real_imag()
(cos(1), sin(1))
>>> exp(1+I).as_real_imag()
(E*cos(1), E*sin(1))
See Also
sympy.functions.elementary.complexes.re
sympy.functions.elementary.complexes.im'

def as_real_imag(self, deep=True, **hints):

    import sympy
    (re, im) = self.args[0].as_real_imag()
    if deep:
        re = re.expand(deep, **hints)
        im = im.expand(deep, **hints)
    (cos, sin) = (sympy.cos(im), sympy.sin(im))
    return ((exp(re) * cos), (exp(re) * sin))
