Copyright | (c) The University of Glasgow 2001 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | [email protected] |
Stability | provisional |
Portability | portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Complex numbers.
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.
The Foldable
and Traversable
instances traverse the real part first.
!a :+ !a infix 6 | forms a complex number from its real and imaginary rectangular components. |
Monad Complex | Since: 4.9.0.0 |
Functor Complex | |
Applicative Complex | Since: 4.9.0.0 |
Foldable Complex | |
Traversable Complex | |
Eq a => Eq (Complex a) | |
RealFloat a => Floating (Complex a) | Since: 2.1 |
RealFloat a => Fractional (Complex a) | Since: 2.1 |
Data a => Data (Complex a) | |
RealFloat a => Num (Complex a) | Since: 2.1 |
Read a => Read (Complex a) | |
Show a => Show (Complex a) | |
Generic (Complex a) | |
Storable a => Storable (Complex a) | Since: 4.8.0.0 |
Generic1 * Complex | |
type Rep (Complex a) | |
type Rep1 * Complex | |
realPart :: Complex a -> a Source
Extracts the real part of a complex number.
imagPart :: Complex a -> a Source
Extracts the imaginary part of a complex number.
mkPolar :: Floating a => a -> a -> Complex a Source
Form a complex number from polar components of magnitude and phase.
cis :: Floating a => a -> Complex a Source
cis t
is a complex value with magnitude 1
and phase t
(modulo 2*pi
).
polar :: RealFloat 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.
magnitude :: RealFloat a => Complex a -> a Source
The nonnegative magnitude of a complex number.
phase :: RealFloat 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 :: Num a => Complex a -> Complex a Source
The conjugate of a complex number.
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.2.1/docs/html/libraries/base-4.10.0.0/Data-Complex.html