Mercurial > cpython-lru_cache-weakref
annotate Doc/libcmath.tex @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | 6d40ebd92227 |
| children | 32663267eb40 |
| rev | line source |
|---|---|
|
5809
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 \section{Built-in Module \sectcode{cmath}} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 \label{module-cmath} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 \bimodindex{cmath} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 \renewcommand{\indexsubitem}{(in module cmath)} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 This module is always available. |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 It provides access to mathematical functions for complex numbers. |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 The functions are: |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 \iftexi |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 \begin{funcdesc}{acos}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 \funcline{asin}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 \funcline{atan}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 \funcline{cos}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 \funcline{cosh}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 \funcline{exp}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 \funcline{log}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 \funcline{log10}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 \funcline{sin}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 \funcline{sinh}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 \funcline{sqrt}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 \funcline{tan}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 \funcline{tanh}{x} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
23 \end{funcdesc} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 \else |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 \code{acos(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 \code{acosh(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 \code{asin(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 \code{asinh(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 \code{atan(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 \code{atanh(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 \code{cos(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 \code{cosh(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 \code{exp(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 \code{log(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 \code{log10(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 \code{sin(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 \code{sinh(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 \code{sqrt(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 \code{tan(\varvars{x})}, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
40 \code{tanh(\varvars{x})}. |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 \fi |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 The module also defines two mathematical constants: |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 \iftexi |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
45 \begin{datadesc}{pi} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 \dataline{e} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 \end{datadesc} |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 \else |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 \code{pi} and \code{e}. |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 \fi |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
52 Note that the selection of functions is similar, but not identical, to |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
53 that in module \code{math}. The reason for having two modules is, |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 that some users aren't interested in complex numbers, and perhaps |
| 5810 | 55 don't even know what they are. They would rather have \code{math.sqrt(-1)} |
|
5809
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 raise an exception than return a complex number. Also note that the |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
57 functions defined in \code{cmath} always return a complex number, even |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 if the answer can be expressed as a real number (in which case the |
|
5120ea86b25d
New cmath module docs, by AMK (with additions and deletions by Guido).
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 complex number has an imaginary part of zero). |
