~ chicken-core (master) /manual/Module (scheme complex)
Trap1[[tags: manual]]2[[toc:]]34== Module (scheme complex)567R7RS Operations on complex numbers.8910<procedure>(make-rectangular x[1] x[2])</procedure><br>11<procedure>(make-polar x[3] x[4])</procedure><br>12<procedure>(real-part z)</procedure>13<procedure>(imag-part z)</procedure>14<procedure>(magnitude z)</procedure>15<procedure>(angle z)</procedure>1617Let x[1], x[2], x[3] and x[4] be real numbers and z be a complex number such that1819 z = x[1] + x[2] * i = x[3] * e^(i * x[4])2021Then all of2223 (make-rectangular x[1] x[2]) ==> z24 (make-polar x[3] x[4]) ==> z25 (real-part z) ==> x[1]26 (imag-part z) ==> x[2]27 (magnitude z) ==> |x[3]|28 (angle z) ==> x[angle]2930are true, where3132 −π ≤ x[angle] ≤ π with x[angle] = x[4] + 2 * π * n for some integer n.3334The make-polar procedure may return an inexact complex number even if its35arguments are exact. The real-part and imag-part procedures may return exact36real numbers when applied to an inexact complex number if the corresponding37argument passed to make-rectangular was exact.3839Rationale: The magnitude procedure is the same as abs for a real argument,40but abs is in the base library, whereas magnitude is in the optional41complex library.4243---44Previous: [[Module (scheme char)]]4546Next: [[Module (scheme cxr)]]