459 lines
33 KiB
HTML
459 lines
33 KiB
HTML
<?xml version="1.0" encoding="iso-8859-1" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
|
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
|
>
|
|
<head><title>17 Data.Complex</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
|
|
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
|
|
<!-- 2,html,xhtml -->
|
|
<meta name="src" content="haskell.tex" />
|
|
<meta name="date" content="2010-07-20 13:11:00" />
|
|
<link rel="stylesheet" type="text/css" href="haskell.css" />
|
|
</head><body
|
|
>
|
|
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
|
|
href="haskellch18.html" >next</a>] [<a
|
|
href="haskellch16.html" >prev</a>] [<a
|
|
href="haskellch16.html#tailhaskellch16.html" >prev-tail</a>] [<a
|
|
href="#tailhaskellch17.html">tail</a>] [<a
|
|
href="haskellpa2.html#haskellch17.html" >up</a>] </p></div>
|
|
<h2 class="chapterHead"><span class="titlemark">Chapter 17</span><br /><a
|
|
id="x25-21800017"></a><span
|
|
class="pcrr7t-">Data.Complex</span></h2>
|
|
<div class="quote">
|
|
|
|
|
|
|
|
<div class="verbatim" id="verbatim-388">
|
|
module Data.Complex (
|
|
 <br />    Complex(:+),  realPart,  imagPart,  mkPolar,  cis,  polar,  magnitude,
|
|
 <br />    phase,  conjugate
|
|
 <br />  ) where
|
|
</div>
|
|
<p class="noindent"></div>
|
|
<h3 class="sectionHead"><span class="titlemark">17.1 </span> <a
|
|
id="x25-21900017.1"></a>Rectangular form </h3>
|
|
<p class="noindent">
|
|
<dl> <dt class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"> <table id="TBL-224" class="tabular"
|
|
cellspacing="0" cellpadding="0" rules="groups"
|
|
><colgroup id="TBL-224-1g"><col
|
|
id="TBL-224-1" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-224-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-224-1-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">data</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Complex</span><span
|
|
class="pcrb7t-"> a </span></td>
|
|
</tr></table> </div> <dd class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"><table id="TBL-225" class="tabulary"
|
|
cellspacing="0" cellpadding="0"
|
|
><colgroup id="TBL-225-1g"><col
|
|
id="TBL-225-1" /><col
|
|
id="TBL-225-2" /><col
|
|
id="TBL-225-3" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-225-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-225-1-1"
|
|
class="td11"> <span
|
|
class="pcrb7t-">= </span></td><td style="white-space:nowrap; text-align:left;" id="TBL-225-1-2"
|
|
class="td11"> <span
|
|
class="pcrb7t-">!a :+ !a </span></td><td style="white-space:wrap; text-align:left;" id="TBL-225-1-3"
|
|
class="td11"> forms a complex number from its real and imaginary rectangular components. </td>
|
|
</tr><tr
|
|
style="vertical-align:baseline;" id="TBL-225-2-"><td style="white-space:nowrap; text-align:left;" id="TBL-225-2-1"
|
|
class="td11"> </td></tr></table>
|
|
</div>
|
|
<p class="noindent"> Complex numbers are an algebraic type.
|
|
<p class="noindent"> For a complex number <span
|
|
class="pcrr7t-">z</span>, <span
|
|
class="pcrr7t-">abs</span><span
|
|
class="pcrr7t-"> z </span>is a number with the magnitude of <span
|
|
class="pcrr7t-">z</span>, but oriented in the positive real
|
|
direction, whereas <span
|
|
class="pcrr7t-">signum</span><span
|
|
class="pcrr7t-"> z </span>has the phase of <span
|
|
class="pcrr7t-">z</span>, but unit magnitude.
|
|
</dl>
|
|
<p class="noindent">
|
|
<dl> <dt class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"> <table id="TBL-226" class="tabular"
|
|
cellspacing="0" cellpadding="0" rules="groups"
|
|
><colgroup id="TBL-226-1g"><col
|
|
id="TBL-226-1" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-226-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-226-1-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">instance</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Eq</span><span
|
|
class="pcrb7t-"> (Complex</span><span
|
|
class="pcrb7t-"> a) </span></td>
|
|
</tr><tr
|
|
style="vertical-align:baseline;" id="TBL-226-2-"><td style="white-space:nowrap; text-align:left;" id="TBL-226-2-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">instance</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Floating</span><span
|
|
class="pcrb7t-"> (Complex</span><span
|
|
class="pcrb7t-"> a) </span></td>
|
|
</tr><tr
|
|
style="vertical-align:baseline;" id="TBL-226-3-"><td style="white-space:nowrap; text-align:left;" id="TBL-226-3-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">instance</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Fractional</span><span
|
|
class="pcrb7t-"> (Complex</span><span
|
|
class="pcrb7t-"> a) </span></td>
|
|
</tr><tr
|
|
style="vertical-align:baseline;" id="TBL-226-4-"><td style="white-space:nowrap; text-align:left;" id="TBL-226-4-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">instance</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Num</span><span
|
|
class="pcrb7t-"> (Complex</span><span
|
|
class="pcrb7t-"> a) </span></td>
|
|
</tr><tr
|
|
style="vertical-align:baseline;" id="TBL-226-5-"><td style="white-space:nowrap; text-align:left;" id="TBL-226-5-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">instance</span><span
|
|
class="pcrb7t-"> (Read</span><span
|
|
class="pcrb7t-"> a,</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a)</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Read</span><span
|
|
class="pcrb7t-"> (Complex</span><span
|
|
class="pcrb7t-"> a) </span></td>
|
|
</tr><tr
|
|
style="vertical-align:baseline;" id="TBL-226-6-"><td style="white-space:nowrap; text-align:left;" id="TBL-226-6-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">instance</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Show</span><span
|
|
class="pcrb7t-"> (Complex</span><span
|
|
class="pcrb7t-"> a) </span></td>
|
|
</tr></table> </div> <dd class="haddockdesc">
|
|
</dl>
|
|
<p class="noindent">
|
|
<dl><dt class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"> <table id="TBL-227" class="tabular"
|
|
cellspacing="0" cellpadding="0" rules="groups"
|
|
><colgroup id="TBL-227-1g"><col
|
|
id="TBL-227-1" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-227-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-227-1-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">realPart</span><span
|
|
class="pcrb7t-"> ::</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Complex</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> -></span><span
|
|
class="pcrb7t-"> a </span></td>
|
|
</tr></table> </div> <dd class="haddockdesc">
|
|
Extracts the real part of a complex number.
|
|
</dl>
|
|
<p class="noindent">
|
|
<dl> <dt class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"> <table id="TBL-228" class="tabular"
|
|
cellspacing="0" cellpadding="0" rules="groups"
|
|
><colgroup id="TBL-228-1g"><col
|
|
id="TBL-228-1" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-228-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-228-1-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">imagPart</span><span
|
|
class="pcrb7t-"> ::</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Complex</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> -></span><span
|
|
class="pcrb7t-"> a </span></td>
|
|
</tr></table> </div> <dd class="haddockdesc">
|
|
Extracts the imaginary part of a complex number.
|
|
</dl>
|
|
|
|
|
|
|
|
<p class="noindent">
|
|
<h3 class="sectionHead"><span class="titlemark">17.2 </span> <a
|
|
id="x25-22000017.2"></a>Polar form </h3>
|
|
<p class="noindent">
|
|
<dl> <dt class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"> <table id="TBL-229" class="tabular"
|
|
cellspacing="0" cellpadding="0" rules="groups"
|
|
><colgroup id="TBL-229-1g"><col
|
|
id="TBL-229-1" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-229-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-229-1-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">mkPolar</span><span
|
|
class="pcrb7t-"> ::</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> -></span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> -></span><span
|
|
class="pcrb7t-"> Complex</span><span
|
|
class="pcrb7t-"> a </span></td>
|
|
</tr></table> </div> <dd class="haddockdesc">
|
|
Form a complex number from polar components of magnitude and phase.
|
|
</dl>
|
|
<p class="noindent">
|
|
<dl> <dt class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"> <table id="TBL-230" class="tabular"
|
|
cellspacing="0" cellpadding="0" rules="groups"
|
|
><colgroup id="TBL-230-1g"><col
|
|
id="TBL-230-1" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-230-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-230-1-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">cis</span><span
|
|
class="pcrb7t-"> ::</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> -></span><span
|
|
class="pcrb7t-"> Complex</span><span
|
|
class="pcrb7t-"> a </span></td>
|
|
</tr></table> </div> <dd class="haddockdesc">
|
|
<span
|
|
class="pcrr7t-">cis</span><span
|
|
class="pcrr7t-"> t </span>is a complex value with magnitude <span
|
|
class="pcrr7t-">1 </span>and phase <span
|
|
class="pcrr7t-">t </span>(modulo <span
|
|
class="pcrr7t-">2⋆pi</span>).
|
|
</dl>
|
|
<p class="noindent">
|
|
<dl> <dt class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"> <table id="TBL-231" class="tabular"
|
|
cellspacing="0" cellpadding="0" rules="groups"
|
|
><colgroup id="TBL-231-1g"><col
|
|
id="TBL-231-1" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-231-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-231-1-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">polar</span><span
|
|
class="pcrb7t-"> ::</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Complex</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> -></span><span
|
|
class="pcrb7t-"> (a,</span><span
|
|
class="pcrb7t-"> a) </span></td>
|
|
</tr></table> </div> <dd class="haddockdesc">
|
|
The function <span
|
|
class="pcrr7t-">polar</span><a
|
|
id="dx25-220001"></a> takes a complex number and returns a (magnitude, phase) pair in canonical form:
|
|
the magnitude is nonnegative, and the phase in the range <span
|
|
class="pcrr7t-">(-pi,</span><span
|
|
class="pcrr7t-"> pi]</span>; if the magnitude is zero, then
|
|
so is the phase.
|
|
</dl>
|
|
<p class="noindent">
|
|
<dl> <dt class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"> <table id="TBL-232" class="tabular"
|
|
cellspacing="0" cellpadding="0" rules="groups"
|
|
><colgroup id="TBL-232-1g"><col
|
|
id="TBL-232-1" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-232-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-232-1-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">magnitude</span><span
|
|
class="pcrb7t-"> ::</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Complex</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> -></span><span
|
|
class="pcrb7t-"> a </span></td>
|
|
</tr></table> </div> <dd class="haddockdesc">
|
|
The nonnegative magnitude of a complex number.
|
|
</dl>
|
|
<p class="noindent">
|
|
<dl> <dt class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"> <table id="TBL-233" class="tabular"
|
|
cellspacing="0" cellpadding="0" rules="groups"
|
|
><colgroup id="TBL-233-1g"><col
|
|
id="TBL-233-1" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-233-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-233-1-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">phase</span><span
|
|
class="pcrb7t-"> ::</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Complex</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> -></span><span
|
|
class="pcrb7t-"> a </span></td>
|
|
</tr></table> </div> <dd class="haddockdesc">
|
|
The phase of a complex number, in the range <span
|
|
class="pcrr7t-">(-pi,</span><span
|
|
class="pcrr7t-"> pi]</span>. If the magnitude is zero, then so is the
|
|
phase.
|
|
</dl>
|
|
|
|
|
|
|
|
<p class="noindent">
|
|
<h3 class="sectionHead"><span class="titlemark">17.3 </span> <a
|
|
id="x25-22100017.3"></a>Conjugate </h3>
|
|
<p class="noindent">
|
|
<dl> <dt class="haddockdesc">
|
|
<!--tex4ht:inline--><div class="tabular"> <table id="TBL-234" class="tabular"
|
|
cellspacing="0" cellpadding="0" rules="groups"
|
|
><colgroup id="TBL-234-1g"><col
|
|
id="TBL-234-1" /></colgroup><tr
|
|
style="vertical-align:baseline;" id="TBL-234-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-234-1-1"
|
|
class="td11"><span
|
|
class="pcrb7t-">conjugate</span><span
|
|
class="pcrb7t-"> ::</span><span
|
|
class="pcrb7t-"> RealFloat</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> =></span><span
|
|
class="pcrb7t-"> Complex</span><span
|
|
class="pcrb7t-"> a</span><span
|
|
class="pcrb7t-"> -></span><span
|
|
class="pcrb7t-"> Complex</span><span
|
|
class="pcrb7t-"> a </span></td>
|
|
</tr></table> </div> <dd class="haddockdesc">
|
|
The conjugate of a complex number.
|
|
</dl>
|
|
<p class="noindent">
|
|
<h3 class="sectionHead"><span class="titlemark">17.4 </span> <a
|
|
id="x25-22200017.4"></a>Specification </h3>
|
|
<p class="noindent">
|
|
<div class="quote">
|
|
|
|
|
|
|
|
<div class="verbatim" id="verbatim-389">
|
|
 module Data.Complex(Complex((:+)), realPart, imagPart, conjugate, mkPolar,
|
|
 <br />                     cis, polar, magnitude, phase)  where
|
|
 <br />
|
|
 <br /> infix  6  :+
|
|
 <br />
|
|
 <br /> data  (RealFloat a)     => Complex a = !a :+ !a  deriving (Eq,Read,Show)
|
|
 <br />
|
|
 <br />
|
|
 <br /> realPart, imagPart :: (RealFloat a) => Complex a -> a
|
|
 <br /> realPart (x:+y)        =  x
|
|
 <br /> imagPart (x:+y)        =  y
|
|
 <br />
|
|
 <br /> conjugate      :: (RealFloat a) => Complex a -> Complex a
|
|
 <br /> conjugate (x:+y) =  x :+ (-y)
|
|
 <br />
|
|
 <br /> mkPolar                :: (RealFloat a) => a -> a -> Complex a
|
|
 <br /> mkPolar r theta        =  r ⋆ cos theta :+ r ⋆ sin theta
|
|
 <br />
|
|
 <br /> cis            :: (RealFloat a) => a -> Complex a
|
|
 <br /> cis theta      =  cos theta :+ sin theta
|
|
 <br />
|
|
 <br /> polar          :: (RealFloat a) => Complex a -> (a,a)
|
|
 <br /> polar z                =  (magnitude z, phase z)
|
|
 <br />
|
|
 <br /> magnitude :: (RealFloat a) => Complex a -> a
|
|
 <br /> magnitude (x:+y) =  scaleFloat k
|
|
 <br />                    (sqrt ((scaleFloat mk x)^2 + (scaleFloat mk y)^2))
|
|
 <br />                   where k  = max (exponent x) (exponent y)
|
|
 <br />                         mk = - k
|
|
 <br />
|
|
 <br /> phase :: (RealFloat a) => Complex a -> a
|
|
 <br /> phase (0 :+ 0) = 0
|
|
 <br /> phase (x :+ y) = atan2 y x
|
|
 <br />
|
|
 <br />
|
|
 <br /> instance  (RealFloat a) => Num (Complex a)  where
|
|
 <br />     (x:+y) + (x':+y') =  (x+x') :+ (y+y')
|
|
 <br />     (x:+y) - (x':+y') =  (x-x') :+ (y-y')
|
|
 <br />     (x:+y) ⋆ (x':+y') =  (x⋆x'-y⋆y') :+ (x⋆y'+y⋆x')
|
|
 <br />     negate (x:+y)     =  negate x :+ negate y
|
|
 <br />     abs z             =  magnitude z :+ 0
|
|
 <br />     signum 0          =  0
|
|
 <br />     signum z@(x:+y)   =  x/r :+ y/r  where r = magnitude z
|
|
 <br />     fromInteger n     =  fromInteger n :+ 0
|
|
 <br />
|
|
 <br /> instance  (RealFloat a) => Fractional (Complex a)  where
|
|
 <br />     (x:+y) / (x':+y') =  (x⋆x''+y⋆y'') / d :+ (y⋆x''-x⋆y'') / d
|
|
|
|
|
|
|
|
 <br />                          where x'' = scaleFloat k x'
|
|
 <br />                                y'' = scaleFloat k y'
|
|
 <br />                                k   = - max (exponent x') (exponent y')
|
|
 <br />                                d   = x'⋆x'' + y'⋆y''
|
|
 <br />
|
|
 <br />     fromRational a    =  fromRational a :+ 0
|
|
 <br />
|
|
 <br /> instance  (RealFloat a) => Floating (Complex a)       where
|
|
 <br />     pi             =  pi :+ 0
|
|
 <br />     exp (x:+y)     =  expx ⋆ cos y :+ expx ⋆ sin y
|
|
 <br />                       where expx = exp x
|
|
 <br />     log z          =  log (magnitude z) :+ phase z
|
|
 <br />
|
|
 <br />     sqrt 0         =  0
|
|
 <br />     sqrt z@(x:+y)  =  u :+ (if y < 0 then -v else v)
|
|
 <br />                       where (u,v) = if x < 0 then (v',u') else (u',v')
|
|
 <br />                             v'    = abs y / (u'⋆2)
|
|
 <br />                             u'    = sqrt ((magnitude z + abs x) / 2)
|
|
 <br />
|
|
 <br />     sin (x:+y)     =  sin x ⋆ cosh y :+ cos x ⋆ sinh y
|
|
 <br />     cos (x:+y)     =  cos x ⋆ cosh y :+ (- sin x ⋆ sinh y)
|
|
 <br />     tan (x:+y)     =  (sinx⋆coshy:+cosx⋆sinhy)/(cosx⋆coshy:+(-sinx⋆sinhy))
|
|
 <br />                       where sinx  = sin x
|
|
 <br />                             cosx  = cos x
|
|
 <br />                             sinhy = sinh y
|
|
 <br />                             coshy = cosh y
|
|
 <br />
|
|
 <br />     sinh (x:+y)    =  cos y ⋆ sinh x :+ sin  y ⋆ cosh x
|
|
 <br />     cosh (x:+y)    =  cos y ⋆ cosh x :+ sin y ⋆ sinh x
|
|
 <br />     tanh (x:+y)    =  (cosy⋆sinhx:+siny⋆coshx)/(cosy⋆coshx:+siny⋆sinhx)
|
|
 <br />                       where siny  = sin y
|
|
 <br />                             cosy  = cos y
|
|
 <br />                             sinhx = sinh x
|
|
 <br />                             coshx = cosh x
|
|
 <br />
|
|
 <br />     asin z@(x:+y)  =  y':+(-x')
|
|
 <br />                       where  (x':+y') = log (((-y):+x) + sqrt (1 - z⋆z))
|
|
 <br />     acos z@(x:+y)  =  y'':+(-x'')
|
|
 <br />                       where (x'':+y'') = log (z + ((-y'):+x'))
|
|
 <br />                             (x':+y')   = sqrt (1 - z⋆z)
|
|
 <br />     atan z@(x:+y)  =  y':+(-x')
|
|
 <br />                       where (x':+y') = log (((1-y):+x) / sqrt (1+z⋆z))
|
|
 <br />
|
|
 <br />     asinh z        =  log (z + sqrt (1+z⋆z))
|
|
 <br />     acosh z        =  log (z + (z+1) ⋆ sqrt ((z-1)/(z+1)))
|
|
 <br />     atanh z        =  log ((1+z) / sqrt (1-z⋆z))
|
|
 <br />
|
|
</div>
|
|
<p class="noindent"></div>
|
|
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
|
|
href="haskellch18.html" >next</a>] [<a
|
|
href="haskellch16.html" >prev</a>] [<a
|
|
href="haskellch16.html#tailhaskellch16.html" >prev-tail</a>] [<a
|
|
href="haskellch17.html" >front</a>] [<a
|
|
href="haskellpa2.html#haskellch17.html" >up</a>] </p></div>
|
|
|
|
|
|
|
|
<p class="noindent"> <a
|
|
id="tailhaskellch17.html"></a>
|
|
</body> </html>
|