I am writing a code which involves solving this equation
X = solve(Theta_Mod_Eqn*Ramp_Equation/(x+PT) - C, x)
I am using sympy library, now the
The set of real numbers is a subset of the set of complex numbers. So, every real number is a complex number. For example, 3 is a complex number.
The correct question to ask is how to find out if a root is real. For that, you can use i.is_real
if i is a SymPy symbol:
for i in X:
if i.is_real:
if (i>-0.01 and i<maxSheaveDisp):
A = i
One can also compare im(i) to 0
: if im(i) == 0
. This works for Python floats too.