Portability | portable |
---|---|

Stability | provisional |

Maintainer | libraries@haskell.org |

Safe Haskell | Trustworthy |

Complex numbers.

- data Complex a = !a :+ !a
- realPart :: RealFloat a => Complex a -> a
- imagPart :: RealFloat a => Complex a -> a
- mkPolar :: RealFloat a => a -> a -> Complex a
- cis :: RealFloat a => a -> Complex a
- polar :: RealFloat a => Complex a -> (a, a)
- magnitude :: RealFloat a => Complex a -> a
- phase :: RealFloat a => Complex a -> a
- conjugate :: RealFloat a => Complex a -> Complex a

# Rectangular form

Complex numbers are an algebraic type.

For a complex number `z`

,

is a number with the magnitude of `abs`

z`z`

,
but oriented in the positive real direction, whereas

has the phase of `signum`

z`z`

, but unit magnitude.

!a :+ !a | forms a complex number from its real and imaginary rectangular components. |

# Polar form

mkPolar :: RealFloat a => a -> a -> Complex aSource

Form a complex number from polar components of magnitude and phase.