Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I calculate only the imaginary part of a number?

So I have the following function which the x will be the difference between two point:

def complexDis(x): return sqrt((x.real()^2)+((x.imag()*-i)^2))

But it seems like i can’t actually operate the .real or .imag number or at least I can’t print it out with N(conplexDis(b-a)) so im asking how can I achieve my goal?

How can I calculate only the imaginary part of a number?

So I have the following function which the x will be the difference between two point:

def complexDis(x): return sqrt((x.real()^2)+((x.imag()*-i)^2))

But it seems like i can’t actually operate the .real or .imag number or at least I can’t print it out with N(conplexDis(b-a)) so im asking how can I achieve my goal?