| Portability | portable (?) |
|---|---|
| Stability | provisional |
| Maintainer | numericprelude@henning-thielemann.de |
| Safe Haskell | None |
Number.Complex
Description
Complex numbers.
- data T a
- imaginaryUnit :: C a => T a
- fromReal :: C a => a -> T a
- (+:) :: a -> a -> T a
- (-:) :: C a => a -> a -> T a
- scale :: C a => a -> T a -> T a
- exp :: C a => T a -> T a
- quarterLeft :: C a => T a -> T a
- quarterRight :: C a => T a -> T a
- fromPolar :: C a => a -> a -> T a
- cis :: C a => a -> T a
- signum :: (C a, C a) => T a -> T a
- signumNorm :: (C a, C a a, C a) => T a -> T a
- toPolar :: (C a, C a) => T a -> (a, a)
- magnitude :: C a => T a -> a
- magnitudeSqr :: C a => T a -> a
- phase :: (C a, C a) => T a -> a
- conjugate :: C a => T a -> T a
- propPolar :: (C a, C a) => T a -> Bool
- class C a => Power a where
- defltPow :: (C a, C a) => Rational -> T a -> T a
Cartesian form
Complex numbers are an algebraic type.
Instances
| Functor T | |
| C T | |
| C a b => C a (T b) | The '(*>)' method can't replace |
| C a b => C a (T b) | |
| (C a, Sqr a b) => C a (T b) | |
| Sqr a b => Sqr a (T b) | |
| (Ord a, C a v) => C a (T v) | |
| (C a, C a v) => C a (T v) | |
| (Show v, C v, C v, C a v) => C a (T v) | |
| Eq a => Eq (T a) | |
| (Floating a, Eq a) => Fractional (T a) | |
| (Floating a, Eq a) => Num (T a) | |
| Read a => Read (T a) | |
| Show a => Show (T a) | |
| Arbitrary a => Arbitrary (T a) | |
| Storable a => Storable (T a) | |
| C a => C (T a) | |
| C a => C (T a) | |
| C a => C (T a) | |
| C a => C (T a) | |
| C a => C (T a) | |
| (Ord a, C a) => C (T a) | |
| (Ord a, C a, C a) => C (T a) | |
| (C a, C a, C a) => C (T a) | |
| C a => C (T a) | |
| (C a, C a, Power a) => C (T a) | |
| (C a, C a, C a, Power a) => C (T a) |
imaginaryUnit :: C a => T aSource
quarterLeft :: C a => T a -> T aSource
Turn the point one quarter to the right.
quarterRight :: C a => T a -> T aSource
Turn the point one quarter to the right.
Polar form
fromPolar :: C a => a -> a -> T aSource
Form a complex number from polar components of magnitude and phase.
magnitudeSqr :: C a => T a -> aSource
Conjugate
Properties
Auxiliary classes
class C a => Power a whereSource
We like to build the Complex Algebraic instance
on top of the Algebraic instance of the scalar type.
This poses no problem to sqrt.
However, root requires computing the complex argument
which is a transcendent operation.
In order to keep the type class dependencies clean
for more sophisticated algebraic number types,
we introduce a type class which actually performs the radix operation.