base-4.7.0.0: Basic libraries

Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityprovisional
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Data.Complex

Contents

Description

Complex numbers.

Synopsis

Rectangular form

data Complex 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 infix 6

forms a complex number from its real and imaginary rectangular components.

Instances

Eq a ⇒ Eq (Complex a) 
RealFloat a ⇒ Floating (Complex a) 
RealFloat a ⇒ Fractional (Complex a) 
Data a ⇒ Data (Complex a) 
RealFloat a ⇒ Num (Complex a) 
Read a ⇒ Read (Complex a) 
Show a ⇒ Show (Complex a) 
Typeable (★ → ★) Complex 

realPartRealFloat a ⇒ Complex a → a Source

Extracts the real part of a complex number.

imagPartRealFloat a ⇒ Complex a → a Source

Extracts the imaginary part of a complex number.

Polar form

mkPolarRealFloat a ⇒ a → a → Complex a Source

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

cisRealFloat a ⇒ a → Complex a Source

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

polarRealFloat a ⇒ Complex 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.

magnitudeRealFloat a ⇒ Complex a → a Source

The nonnegative magnitude of a complex number.

phaseRealFloat a ⇒ Complex a → a Source

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

Conjugate

conjugateRealFloat a ⇒ Complex a → Complex a Source

The conjugate of a complex number.