Portability | portable |
---|---|

Stability | provisional |

Maintainer | conal@conal.net |

Complex numbers. This version is modified from Data.Complex in base.
It eliminates the RealFloat requirement by using a more naive
definition of `magnitude`

. Also, defines instances for vector-space classes.

- 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 :: Floating a => Complex a -> (a, a)
- phase :: Floating a => Complex a -> a
- conjugate :: Num a => Unop (Complex a)
- onRI :: Unop a -> Unop (Complex a)
- onRI2 :: Binop a -> Binop (Complex a)

# Rectangular form

Complex numbers are an algebraic type.

For a complex number `z`

,

is a number with the magnitude of `abs`

z`z`

,
but oriented in the positive real direction, whereas

has the phase of `signum`

z`z`

, but unit magnitude.

!a :+ !a | forms a complex number from its real and imaginary rectangular components. |

Typeable1 Complex | |

Eq a => Eq (Complex a) | |

Floating a => Floating (Complex a) | |

Floating a => Fractional (Complex a) | |

Data a => Data (Complex a) | |

Floating a => Num (Complex a) | |

Read a => Read (Complex a) | |

Show a => Show (Complex a) | |

Floating a => VectorSpace (Complex a) | |

Floating a => InnerSpace (Complex a) | |

Floating a => AdditiveGroup (Complex a) | |

FMod s => FMod (Complex s) | |

Frac s => Frac (Complex s) | |

HasExpr a => HasExpr (Complex a) | |

(Show a, IsScalar a) => FromE (ComplexE a) | |

(Show a, IsScalar a) => ToE (ComplexE a) |

# Polar form

mkPolar :: Floating a => a -> a -> Complex aSource

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