Copyright | (c) The University of Glasgow 2001 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | libraries@haskell.org |
Stability | provisional |
Portability | portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Complex numbers.
- data Complex a = !a :+ !a
- realPart :: Complex a -> a
- imagPart :: Complex a -> a
- mkPolar :: Floating a => a -> a -> Complex a
- cis :: Floating a => a -> Complex a
- polar :: RealFloat a => Complex a -> (a, a)
- magnitude :: RealFloat a => Complex a -> a
- phase :: RealFloat a => Complex a -> a
- conjugate :: Num 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
zz
,
but oriented in the positive real direction, whereas
has the phase of signum
zz
, 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 Source # | Since: 4.9.0.0 |
Functor Complex Source # | |
Applicative Complex Source # | Since: 4.9.0.0 |
Foldable Complex Source # | |
Traversable Complex Source # | |
Eq a => Eq (Complex a) Source # | |
RealFloat a => Floating (Complex a) Source # | Since: 2.1 |
RealFloat a => Fractional (Complex a) Source # | Since: 2.1 |
Data a => Data (Complex a) Source # | |
RealFloat a => Num (Complex a) Source # | Since: 2.1 |
Read a => Read (Complex a) Source # | |
Show a => Show (Complex a) Source # | |
Generic (Complex a) Source # | |
Storable a => Storable (Complex a) Source # | Since: 4.8.0.0 |
Generic1 * Complex Source # | |
type Rep (Complex a) Source # | |
type Rep1 * Complex Source # | |
Polar form
mkPolar :: Floating a => a -> a -> Complex a Source #
Form a complex number from polar components of magnitude and phase.