chickadee » scheme » imag-part

(make-rectangular x[1] x[2])procedure
(make-polar x[3] x[4])procedure
real-part zprocedure
imag-part zprocedure
magnitude zprocedure
angle zprocedure

These procedures are part of every implementation that supports general complex numbers. Suppose x[1], x[2], x[3], and x[4] are real numbers and z is a complex number such that

z = x[1] + x[2]i = x[3] . e^i x[4]


(make-rectangular x[1] x[2])         ===> z
(make-polar x[3] x[4])             ===> z
(real-part z)                          ===> x[1]
(imag-part z)                          ===> x[2]
(magnitude z)                          ===> |x[3]|
(angle z)                              ===> x[angle]

where - pi < x[angle] < pi with x[angle] = x[4] + 2 pi n for some integer n.

Rationale: Magnitude is the same as abs for a real argument, but abs must be present in all implementations, whereas magnitude need only be present in implementations that support general complex numbers.