doppler.py 435 Bytes
from sympy import *
from sympy.simplify.fu import *

init_printing()

#constants
A, B, w, t, kphi, c = symbols('A, B, omega, t, k_phi, c', imaginary=False, real=True)
dx = symbols('delta_x', cls=Function)
#wave vector
k = w/c

#reflected wave
E1 = A*cos(w*t-2*k*dx(t))

#demodulation of E1 at omega in quadrature
E2 = B*cos(w*t-pi/2)
Vmix = 2 * kphi * E1 * E2
Vmix = expand(TR8(TR7(expand(Vmix))))
print('V_mixer = \n' + pretty(Vmix))