polar-0.0.0: Complex numbers in polar form

Data.Complex.Polar

Synopsis

Documentation

data RealFloat a => Polar a Source

Complex numbers are an algebraic type.

For a complex number z, abs z is a number with the magnitude of z, but oriented in the positive real direction, whereas signum z has the phase of z, but unit magnitude.

Constructors

!a :< !a

forms a complex number from its magnitude and its phase in radians.

Instances

Typeable1 Polar 
RealFloat a => Eq (Polar a) 
RealFloat a => Floating (Polar a) 
RealFloat a => Fractional (Polar a) 
(Data a, RealFloat a) => Data (Polar a) 
RealFloat a => Num (Polar a) 
(Read a, RealFloat a) => Read (Polar a) 
RealFloat a => Show (Polar a) 

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

Convert to rectangular form.

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

Convert to polar form.

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

Extracts the real part of a complex number.

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

Extracts the imaginary part of a complex number.

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

The conjugate of a complex number.

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

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

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

cis t is a complex value with magnitude 1 and phase t (modulo 2*pi).

polar :: RealFloat a => Polar a -> (a, a)Source

The function polar takes a complex number and returns a (magnitude, phase) pair in canonical form: the magnitude is nonnegative, and the phase in the range (-pi, pi]; if the magnitude is zero, then so is the phase.

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

The nonnegative magnitude of a complex number.

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

The phase of a complex number, in the range (-pi, pi]. If the magnitude is zero, then so is the phase.