annotate Doc/libmath.tex @ 6719:faebc1940432 legacy-trunk

Understand -Xlinker option.
author Guido van Rossum <guido@python.org>
date Tue, 02 Dec 1997 20:38:11 +0000
parents a7ea74a27993
children 3eca5f37501a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 \section{Built-in Module \sectcode{math}}
5818
3468ea8645ca AMK's megapatch:
Guido van Rossum <guido@python.org>
parents: 3375
diff changeset
2 \label{module-math}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
3
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 \bimodindex{math}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 \renewcommand{\indexsubitem}{(in module math)}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 This module is always available.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 It provides access to the mathematical functions defined by the C
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 standard.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 They are:
6363
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
10
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 \begin{funcdesc}{acos}{x}
6363
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
12 Return the arc cosine of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
13 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
14
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
15 \begin{funcdesc}{asin}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
16 Return the arc sine of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
17 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
18
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
19 \begin{funcdesc}{atan}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
20 Return the arc tangent of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
21 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
22
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
23 \begin{funcdesc}{atan2}{x, y}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
24 Return \code{atan(x / y)}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
25 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
26
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
27 \begin{funcdesc}{ceil}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
28 Return the ceiling of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
29 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
30
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
31 \begin{funcdesc}{cos}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
32 Return the cosine of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
33 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
34
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
35 \begin{funcdesc}{cosh}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
36 Return the hyperbolic cosine of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
37 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
38
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
39 \begin{funcdesc}{exp}{x}
6647
a7ea74a27993 Get rid of math mode in some places.
Guido van Rossum <guido@python.org>
parents: 6485
diff changeset
40 Return \code{e**\var{x}}.
6363
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
41 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
42
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
43 \begin{funcdesc}{fabs}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
44 Return the absolute value of the real \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
45 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
46
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
47 \begin{funcdesc}{floor}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
48 Return the floor of \var{x}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
49 \end{funcdesc}
6363
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
50
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
51 \begin{funcdesc}{fmod}{x, y}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
52 Return \code{x \% y}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
53 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
54
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
55 \begin{funcdesc}{frexp}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
56 Return the matissa and exponent for \var{x}. The mantissa is
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
57 positive.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
58 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
59
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
60 \begin{funcdesc}{hypot}{x, y}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
61 Return the Euclidean distance, \code{sqrt(x*x + y*y)}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
62 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
63
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
64 \begin{funcdesc}{ldexp}{x, i}
6647
a7ea74a27993 Get rid of math mode in some places.
Guido van Rossum <guido@python.org>
parents: 6485
diff changeset
65 Return \code{\var{x} * (2**\var{i})}.
6363
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
66 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
67
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
68 \begin{funcdesc}{modf}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
69 Return the fractional and integer parts of \var{x}. Both results
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
70 carry the sign of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
71 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
72
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
73 \begin{funcdesc}{pow}{x, y}
6647
a7ea74a27993 Get rid of math mode in some places.
Guido van Rossum <guido@python.org>
parents: 6485
diff changeset
74 Return \code{\var{x}**\var{y}}.
6363
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
75 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
76
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
77 \begin{funcdesc}{sin}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
78 Return the sine of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
79 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
80
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
81 \begin{funcdesc}{sinh}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
82 Return the hyperbolic sine of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
83 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
84
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
85 \begin{funcdesc}{sqrt}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
86 Return the square root of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
87 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
88
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
89 \begin{funcdesc}{tan}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
90 Return the tangent of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
91 \end{funcdesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
92
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
93 \begin{funcdesc}{tanh}{x}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
94 Return the hyperbolic tangent of \var{x}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
95 \end{funcdesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
96
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
97 Note that \code{frexp} and \code{modf} have a different call/return
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
98 pattern than their C equivalents: they take a single argument and
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
99 return a pair of values, rather than returning their second return
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
100 value through an `output parameter' (there is no such thing in Python).
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
101
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
102 The module also defines two mathematical constants:
6363
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
103
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
104 \begin{datadesc}{pi}
6363
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
105 The mathematical constant \emph{pi}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
106 \end{datadesc}
5818
3468ea8645ca AMK's megapatch:
Guido van Rossum <guido@python.org>
parents: 3375
diff changeset
107
6363
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
108 \begin{datadesc}{e}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
109 The mathematical constant \emph{e}.
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
110 \end{datadesc}
0c74688bc1ff Fixed up formatting.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
111
6485
2f258162aae2 Restore the \seealso formatting that got lost when I updated the math
Fred Drake <fdrake@acm.org>
parents: 6363
diff changeset
112 \begin{seealso}
2f258162aae2 Restore the \seealso formatting that got lost when I updated the math
Fred Drake <fdrake@acm.org>
parents: 6363
diff changeset
113 \seemodule{cmath}{Complex number versions of many of these functions.}
2f258162aae2 Restore the \seealso formatting that got lost when I updated the math
Fred Drake <fdrake@acm.org>
parents: 6363
diff changeset
114 \end{seealso}