im

im(x)

Try it yourself:

See also:

im(): get an imaginary component

im(x) returns the imaginary part of a complex number. For 3 + 4i, im(3 + 4i) is 4; for an ordinary real number it is 0.

Complex-number calculations

Complex values have a real and imaginary coordinate. Pair im() with re() to inspect both parts, and use conj() to build a value. The conj() function reverses the imaginary sign, while abs() gives its magnitude.

Practical care

im() extracts a component; it does not test whether a result is complex. Tiny floating-point residues can appear where theory predicts zero, so use an appropriate tolerance before declaring an imaginary part absent.

All functions