When executing the following
from sympy import *
R, L, C, w = symbols("R L C w", real = True)
j = symbols("j", real = False)
H = (1 + j * w * C * R) * (j * w * L + R)
H = H.expand()
print(H)
print(latex(H))
the result is as stated below.
C*L*R*j**2*w**2 + C*R**2*j*w + L*j*w + R
C L R j^{2} w^{2} + C R^{2} j w + L j w + R
I want to set j^2 = -1 and j^3 = -j and so on, if necessary. How to do that in this calculation?
Sympy recognizes the imaginary constant as
sympy.I
.