PM.py 514 Bytes
from sympy import *
from sympy.simplify.fu import *

init_printing()

#constants
E0, W, t, m, b= symbols('E0, Omega, t, m, beta', real=True, imaginary=False)

#AM+PM
E_ampm = E0*(1+m*cos(W*t))*exp(I*(W*t+b*sin(W*t)))
I_ampm = abs(E_ampm)**2
I_ampm = expand(TR8(expand(expand_complex(I_ampm))))

#AM
E_am = E0*(1+m*cos(W*t))*exp(I*(W*t))
I_am = abs(E_am)**2
I_am = expand(TR8(expand(expand_complex(I_am))))

#PM
E_pm = E0*exp(I*(W*t+b*sin(W*t)))
I_pm = abs(E_pm)**2
I_pm = expand(TR8(expand(expand_complex(I_pm))))