<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >Data.Complex</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_Data-Complex.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >base-4.1.0.0: Basic libraries</TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >Data.Complex</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >portable</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >provisional</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >libraries@haskell.org</TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >Rectangular form </A ></DT ><DT ><A HREF="#2" >Polar form </A ></DT ><DT ><A HREF="#3" >Conjugate </A ></DT ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" >Complex numbers. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="#t%3AComplex" >Complex</A > a = !a <A HREF="#v%3A%3A%2B" >:+</A > !a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ArealPart" >realPart</A > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AimagPart" >imagPart</A > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkPolar" >mkPolar</A > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => a -> a -> <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Acis" >cis</A > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => a -> <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Apolar" >polar</A > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> (a, a)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Amagnitude" >magnitude</A > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aphase" >phase</A > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aconjugate" >conjugate</A > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a</TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >Rectangular form </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A NAME="t:Complex" ><A NAME="t%3AComplex" ></A ></A ><B >Complex</B > a </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" ><P >Complex numbers are an algebraic type. </P ><P >For a complex number <TT >z</TT >, <TT ><TT ><A HREF="Prelude.html#v%3Aabs" >abs</A ></TT > z</TT > is a number with the magnitude of <TT >z</TT >, but oriented in the positive real direction, whereas <TT ><TT ><A HREF="Prelude.html#v%3Asignum" >signum</A ></TT > z</TT > has the phase of <TT >z</TT >, but unit magnitude. </P ></TD ></TR ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" >!a <A NAME="v::+" ><A NAME="v%3A%3A%2B" ></A ></A ><B >:+</B > !a</TD ><TD CLASS="rdoc" >forms a complex number from its real and imaginary rectangular components. </TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Complex')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:Complex" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Data-Typeable.html#t%3ATypeable1" >Typeable1</A > <A HREF="Data-Complex.html#t%3AComplex" >Complex</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Eq.html#t%3AEq" >Eq</A > (<A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Prelude.html#t%3AFloating" >Floating</A > (<A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Prelude.html#t%3AFractional" >Fractional</A > (<A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Data.html#t%3AData" >Data</A > a, <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Prelude.html#t%3ANum" >Num</A > (<A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Text-Read.html#t%3ARead" >Read</A > a, <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a) => <A HREF="Text-Read.html#t%3ARead" >Read</A > (<A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Text-Show.html#t%3AShow" >Show</A > (<A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a)</TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:realPart" ><A NAME="v%3ArealPart" ></A ></A ><B >realPart</B > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> a</TD ></TR ><TR ><TD CLASS="doc" >Extracts the real part of a complex number. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:imagPart" ><A NAME="v%3AimagPart" ></A ></A ><B >imagPart</B > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> a</TD ></TR ><TR ><TD CLASS="doc" >Extracts the imaginary part of a complex number. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="2" ><A NAME="2" >Polar form </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkPolar" ><A NAME="v%3AmkPolar" ></A ></A ><B >mkPolar</B > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => a -> a -> <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a</TD ></TR ><TR ><TD CLASS="doc" >Form a complex number from polar components of magnitude and phase. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:cis" ><A NAME="v%3Acis" ></A ></A ><B >cis</B > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => a -> <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a</TD ></TR ><TR ><TD CLASS="doc" ><TT ><TT ><A HREF="Data-Complex.html#v%3Acis" >cis</A ></TT > t</TT > is a complex value with magnitude <TT >1</TT > and phase <TT >t</TT > (modulo <TT >2*<TT ><A HREF="Prelude.html#v%3Api" >pi</A ></TT ></TT >). </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:polar" ><A NAME="v%3Apolar" ></A ></A ><B >polar</B > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> (a, a)</TD ></TR ><TR ><TD CLASS="doc" >The function <TT ><A HREF="Data-Complex.html#v%3Apolar" >polar</A ></TT > takes a complex number and returns a (magnitude, phase) pair in canonical form: the magnitude is nonnegative, and the phase in the range <TT >(-<TT ><A HREF="Prelude.html#v%3Api" >pi</A ></TT >, <TT ><A HREF="Prelude.html#v%3Api" >pi</A ></TT >]</TT >; if the magnitude is zero, then so is the phase. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:magnitude" ><A NAME="v%3Amagnitude" ></A ></A ><B >magnitude</B > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> a</TD ></TR ><TR ><TD CLASS="doc" >The nonnegative magnitude of a complex number. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:phase" ><A NAME="v%3Aphase" ></A ></A ><B >phase</B > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> a</TD ></TR ><TR ><TD CLASS="doc" >The phase of a complex number, in the range <TT >(-<TT ><A HREF="Prelude.html#v%3Api" >pi</A ></TT >, <TT ><A HREF="Prelude.html#v%3Api" >pi</A ></TT >]</TT >. If the magnitude is zero, then so is the phase. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="3" ><A NAME="3" >Conjugate </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:conjugate" ><A NAME="v%3Aconjugate" ></A ></A ><B >conjugate</B > :: <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a => <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a -> <A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a</TD ></TR ><TR ><TD CLASS="doc" >The conjugate of a complex number. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.4.2</TD ></TR ></TABLE ></BODY ></HTML >