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

# Documentation

data RealFloat a => Polar a Source

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 magnitude and its phase in radians. |

fromComplex :: RealFloat a => Complex a -> Polar aSource

Convert to polar form.

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

Form a complex number from polar components of magnitude and phase. Phase is wrapped into (-pi,pi].