Safe Haskell | None |
---|---|

Language | Haskell98 |

- data Complex a :: * -> * = !a :+ !a
- real :: Elt a => Exp (Complex a) -> Exp a
- imag :: Elt a => Exp (Complex a) -> Exp a
- mkPolar :: (Elt a, IsFloating a) => Exp a -> Exp a -> Exp (Complex a)
- cis :: (Elt a, IsFloating a) => Exp a -> Exp (Complex a)
- polar :: (Elt a, IsFloating a) => Exp (Complex a) -> Exp (a, a)
- magnitude :: (Elt a, IsFloating a) => Exp (Complex a) -> Exp a
- phase :: (Elt a, IsFloating a) => Exp (Complex a) -> Exp a
- conjugate :: (Elt a, IsNum a) => Exp (Complex a) -> Exp (Complex a)

# Rectangular from

data Complex a :: * -> *

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 infix 6 | forms a complex number from its real and imaginary rectangular components. |

(RealFloat a, Unbox a) => Vector Vector (Complex a) | |

(RealFloat a, Unbox a) => MVector MVector (Complex a) | |

Elt a => Unlift Exp (Complex (Exp a)) | |

(Lift Exp a, Elt (Plain a)) => Lift Exp (Complex a) | |

Eq a => Eq (Complex a) | |

RealFloat a => Floating (Complex a) | |

(Elt a, IsFloating a, RealFloat a) => Floating (Exp (Complex a)) | |

RealFloat a => Fractional (Complex a) | |

(Elt a, IsFloating a) => Fractional (Exp (Complex a)) | |

Data a => Data (Complex a) | |

RealFloat a => Num (Complex a) | |

(Elt a, IsFloating a) => Num (Exp (Complex a)) | |

Read a => Read (Complex a) | |

Show a => Show (Complex a) | |

(RealFloat a, Unbox a) => Unbox (Complex a) | |

Elt a => Elt (Complex a) | |

Typeable (* -> *) Complex | |

data MVector s (Complex a) = MV_Complex (MVector s (a, a)) | |

data Vector (Complex a) = V_Complex (Vector (a, a)) | |

type Plain (Complex a) = Complex (Plain a) |

# Polar form

mkPolar :: (Elt a, IsFloating a) => Exp a -> Exp a -> Exp (Complex a) Source

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

magnitude :: (Elt a, IsFloating a) => Exp (Complex a) -> Exp a Source

The non-negative magnitude of a complex number