(py-indent-right, py-outdent-left): new commands, bound to C-c C-r and
[python/dscho.git] / Doc / libmath.tex
blob6c6a90f9c0307757cee454c1902a0bc8ad622e2b
1 \section{Built-in Module \sectcode{math}}
3 \bimodindex{math}
4 \renewcommand{\indexsubitem}{(in module math)}
5 This module is always available.
6 It provides access to the mathematical functions defined by the C
7 standard.
8 They are:
9 \iftexi
10 \begin{funcdesc}{acos}{x}
11 \funcline{asin}{x}
12 \funcline{atan}{x}
13 \funcline{atan2}{x, y}
14 \funcline{ceil}{x}
15 \funcline{cos}{x}
16 \funcline{cosh}{x}
17 \funcline{exp}{x}
18 \funcline{fabs}{x}
19 \funcline{floor}{x}
20 \funcline{fmod}{x, y}
21 \funcline{frexp}{x}
22 \funcline{hypot}{x, y}
23 \funcline{ldexp}{x, y}
24 \funcline{log}{x}
25 \funcline{log10}{x}
26 \funcline{modf}{x}
27 \funcline{pow}{x, y}
28 \funcline{sin}{x}
29 \funcline{sinh}{x}
30 \funcline{sqrt}{x}
31 \funcline{tan}{x}
32 \funcline{tanh}{x}
33 \end{funcdesc}
34 \else
35 \code{acos(\varvars{x})},
36 \code{asin(\varvars{x})},
37 \code{atan(\varvars{x})},
38 \code{atan2(\varvars{x\, y})},
39 \code{ceil(\varvars{x})},
40 \code{cos(\varvars{x})},
41 \code{cosh(\varvars{x})},
42 \code{exp(\varvars{x})},
43 \code{fabs(\varvars{x})},
44 \code{floor(\varvars{x})},
45 \code{fmod(\varvars{x\, y})},
46 \code{frexp(\varvars{x})},
47 \code{hypot(\varvars{x\, y})},
48 \code{ldexp(\varvars{x\, y})},
49 \code{log(\varvars{x})},
50 \code{log10(\varvars{x})},
51 \code{modf(\varvars{x})},
52 \code{pow(\varvars{x\, y})},
53 \code{sin(\varvars{x})},
54 \code{sinh(\varvars{x})},
55 \code{sqrt(\varvars{x})},
56 \code{tan(\varvars{x})},
57 \code{tanh(\varvars{x})}.
58 \fi
60 Note that \code{frexp} and \code{modf} have a different call/return
61 pattern than their C equivalents: they take a single argument and
62 return a pair of values, rather than returning their second return
63 value through an `output parameter' (there is no such thing in Python).
65 The \code{hypot} function, which is not standard C, is not available
66 on all platforms.
68 The module also defines two mathematical constants:
69 \iftexi
70 \begin{datadesc}{pi}
71 \dataline{e}
72 \end{datadesc}
73 \else
74 \code{pi} and \code{e}.
75 \fi