Copyright | [2015..2017] Trevor L. McDonell |
---|---|
License | BSD3 |
Maintainer | Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> |
Stability | experimental |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell98 |
Complex numbers
- data Complex a :: * -> * = !a :+ !a
- real :: Elt a => Exp (Complex a) -> Exp a
- imag :: Elt a => Exp (Complex a) -> Exp a
- mkPolar :: forall a. Floating a => Exp a -> Exp a -> Exp (Complex a)
- cis :: forall a. Floating a => Exp a -> Exp (Complex a)
- polar :: RealFloat a => Exp (Complex a) -> Exp (a, a)
- magnitude :: RealFloat a => Exp (Complex a) -> Exp a
- phase :: RealFloat a => Exp (Complex a) -> Exp a
- conjugate :: Num a => Exp (Complex a) -> Exp (Complex a)
Rectangular from
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 | Since: 4.9.0.0 |
Functor Complex | |
Applicative Complex | Since: 4.9.0.0 |
Foldable Complex | |
Traversable Complex | |
Unbox a => Vector Vector (Complex a) | |
Unbox a => MVector MVector (Complex a) | |
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 |
NFData a => NFData (Complex a) | |
Unbox a => Unbox (Complex a) | |
Generic1 * Complex | |
data MVector s (Complex a) | |
type Rep (Complex a) | |
data Vector (Complex a) | |
type Plain (Complex a) Source # | |
type Rep1 * Complex | |
Polar form
mkPolar :: forall a. Floating a => Exp a -> Exp a -> Exp (Complex a) Source #
Form a complex number from polar components of magnitude and phase.
magnitude :: RealFloat a => Exp (Complex a) -> Exp a Source #
The non-negative magnitude of a complex number
Conjugate
conjugate :: Num a => Exp (Complex a) -> Exp (Complex a) Source #
Return the complex conjugate of a complex number, defined as
conjugate(Z) = X - iY
Orphan instances
Elt a => Unlift Exp (Complex (Exp a)) Source # | |
(Lift Exp a, Elt (Plain a)) => Lift Exp (Complex a) Source # | |
(FromIntegral a b, Num b) => FromIntegral a (Complex b) Source # | |
RealFloat a => Floating (Exp (Complex a)) Source # | |
RealFloat a => Fractional (Exp (Complex a)) Source # | |
RealFloat a => Num (Exp (Complex a)) Source # | |
Elt a => Elt (Complex a) Source # | |
Eq a => Eq (Complex a) Source # | |