1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module math</title>
<meta charset="utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>math</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/math.so">/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/math.so</a><br><a href="http://docs.python.org/library/math">Module Docs</a></font></td></tr></table>
<p><tt>This module is always available. It provides access to the<br>
mathematical functions defined by the C standard.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-acos"><strong>acos</strong></a>(...)</dt><dd><tt><a href="#-acos">acos</a>(x)<br>
<br>
Return the arc cosine (measured in radians) of x.</tt></dd></dl>
<dl><dt><a name="-acosh"><strong>acosh</strong></a>(...)</dt><dd><tt><a href="#-acosh">acosh</a>(x)<br>
<br>
Return the inverse hyperbolic cosine of x.</tt></dd></dl>
<dl><dt><a name="-asin"><strong>asin</strong></a>(...)</dt><dd><tt><a href="#-asin">asin</a>(x)<br>
<br>
Return the arc sine (measured in radians) of x.</tt></dd></dl>
<dl><dt><a name="-asinh"><strong>asinh</strong></a>(...)</dt><dd><tt><a href="#-asinh">asinh</a>(x)<br>
<br>
Return the inverse hyperbolic sine of x.</tt></dd></dl>
<dl><dt><a name="-atan"><strong>atan</strong></a>(...)</dt><dd><tt><a href="#-atan">atan</a>(x)<br>
<br>
Return the arc tangent (measured in radians) of x.</tt></dd></dl>
<dl><dt><a name="-atan2"><strong>atan2</strong></a>(...)</dt><dd><tt><a href="#-atan2">atan2</a>(y, x)<br>
<br>
Return the arc tangent (measured in radians) of y/x.<br>
Unlike <a href="#-atan">atan</a>(y/x), the signs of both x and y are considered.</tt></dd></dl>
<dl><dt><a name="-atanh"><strong>atanh</strong></a>(...)</dt><dd><tt><a href="#-atanh">atanh</a>(x)<br>
<br>
Return the inverse hyperbolic tangent of x.</tt></dd></dl>
<dl><dt><a name="-ceil"><strong>ceil</strong></a>(...)</dt><dd><tt><a href="#-ceil">ceil</a>(x)<br>
<br>
Return the ceiling of x as a float.<br>
This is the smallest integral value >= x.</tt></dd></dl>
<dl><dt><a name="-copysign"><strong>copysign</strong></a>(...)</dt><dd><tt><a href="#-copysign">copysign</a>(x, y)<br>
<br>
Return x with the sign of y.</tt></dd></dl>
<dl><dt><a name="-cos"><strong>cos</strong></a>(...)</dt><dd><tt><a href="#-cos">cos</a>(x)<br>
<br>
Return the cosine of x (measured in radians).</tt></dd></dl>
<dl><dt><a name="-cosh"><strong>cosh</strong></a>(...)</dt><dd><tt><a href="#-cosh">cosh</a>(x)<br>
<br>
Return the hyperbolic cosine of x.</tt></dd></dl>
<dl><dt><a name="-degrees"><strong>degrees</strong></a>(...)</dt><dd><tt><a href="#-degrees">degrees</a>(x)<br>
<br>
Convert angle x from radians to degrees.</tt></dd></dl>
<dl><dt><a name="-erf"><strong>erf</strong></a>(...)</dt><dd><tt><a href="#-erf">erf</a>(x)<br>
<br>
Error function at x.</tt></dd></dl>
<dl><dt><a name="-erfc"><strong>erfc</strong></a>(...)</dt><dd><tt><a href="#-erfc">erfc</a>(x)<br>
<br>
Complementary error function at x.</tt></dd></dl>
<dl><dt><a name="-exp"><strong>exp</strong></a>(...)</dt><dd><tt><a href="#-exp">exp</a>(x)<br>
<br>
Return e raised to the power of x.</tt></dd></dl>
<dl><dt><a name="-expm1"><strong>expm1</strong></a>(...)</dt><dd><tt><a href="#-expm1">expm1</a>(x)<br>
<br>
Return <a href="#-exp">exp</a>(x)-1.<br>
This function avoids the loss of precision involved in the direct evaluation of <a href="#-exp">exp</a>(x)-1 for small x.</tt></dd></dl>
<dl><dt><a name="-fabs"><strong>fabs</strong></a>(...)</dt><dd><tt><a href="#-fabs">fabs</a>(x)<br>
<br>
Return the absolute value of the float x.</tt></dd></dl>
<dl><dt><a name="-factorial"><strong>factorial</strong></a>(...)</dt><dd><tt><a href="#-factorial">factorial</a>(x) -> Integral<br>
<br>
Find x!. Raise a ValueError if x is negative or non-integral.</tt></dd></dl>
<dl><dt><a name="-floor"><strong>floor</strong></a>(...)</dt><dd><tt><a href="#-floor">floor</a>(x)<br>
<br>
Return the floor of x as a float.<br>
This is the largest integral value <= x.</tt></dd></dl>
<dl><dt><a name="-fmod"><strong>fmod</strong></a>(...)</dt><dd><tt><a href="#-fmod">fmod</a>(x, y)<br>
<br>
Return <a href="#-fmod">fmod</a>(x, y), according to platform C. x % y may differ.</tt></dd></dl>
<dl><dt><a name="-frexp"><strong>frexp</strong></a>(...)</dt><dd><tt><a href="#-frexp">frexp</a>(x)<br>
<br>
Return the mantissa and exponent of x, as pair (m, e).<br>
m is a float and e is an int, such that x = m * 2.**e.<br>
If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.</tt></dd></dl>
<dl><dt><a name="-fsum"><strong>fsum</strong></a>(...)</dt><dd><tt><a href="#-fsum">fsum</a>(iterable)<br>
<br>
Return an accurate floating point sum of values in the iterable.<br>
Assumes IEEE-754 floating point arithmetic.</tt></dd></dl>
<dl><dt><a name="-gamma"><strong>gamma</strong></a>(...)</dt><dd><tt><a href="#-gamma">gamma</a>(x)<br>
<br>
Gamma function at x.</tt></dd></dl>
<dl><dt><a name="-hypot"><strong>hypot</strong></a>(...)</dt><dd><tt><a href="#-hypot">hypot</a>(x, y)<br>
<br>
Return the Euclidean distance, <a href="#-sqrt">sqrt</a>(x*x + y*y).</tt></dd></dl>
<dl><dt><a name="-isinf"><strong>isinf</strong></a>(...)</dt><dd><tt><a href="#-isinf">isinf</a>(x) -> bool<br>
<br>
Check if float x is infinite (positive or negative).</tt></dd></dl>
<dl><dt><a name="-isnan"><strong>isnan</strong></a>(...)</dt><dd><tt><a href="#-isnan">isnan</a>(x) -> bool<br>
<br>
Check if float x is not a number (NaN).</tt></dd></dl>
<dl><dt><a name="-ldexp"><strong>ldexp</strong></a>(...)</dt><dd><tt><a href="#-ldexp">ldexp</a>(x, i)<br>
<br>
Return x * (2**i).</tt></dd></dl>
<dl><dt><a name="-lgamma"><strong>lgamma</strong></a>(...)</dt><dd><tt><a href="#-lgamma">lgamma</a>(x)<br>
<br>
Natural logarithm of absolute value of Gamma function at x.</tt></dd></dl>
<dl><dt><a name="-log"><strong>log</strong></a>(...)</dt><dd><tt><a href="#-log">log</a>(x[, base])<br>
<br>
Return the logarithm of x to the given base.<br>
If the base not specified, returns the natural logarithm (base e) of x.</tt></dd></dl>
<dl><dt><a name="-log10"><strong>log10</strong></a>(...)</dt><dd><tt><a href="#-log10">log10</a>(x)<br>
<br>
Return the base 10 logarithm of x.</tt></dd></dl>
<dl><dt><a name="-log1p"><strong>log1p</strong></a>(...)</dt><dd><tt><a href="#-log1p">log1p</a>(x)<br>
<br>
Return the natural logarithm of 1+x (base e).<br>
The result is computed in a way which is accurate for x near zero.</tt></dd></dl>
<dl><dt><a name="-modf"><strong>modf</strong></a>(...)</dt><dd><tt><a href="#-modf">modf</a>(x)<br>
<br>
Return the fractional and integer parts of x. Both results carry the sign<br>
of x and are floats.</tt></dd></dl>
<dl><dt><a name="-pow"><strong>pow</strong></a>(...)</dt><dd><tt><a href="#-pow">pow</a>(x, y)<br>
<br>
Return x**y (x to the power of y).</tt></dd></dl>
<dl><dt><a name="-radians"><strong>radians</strong></a>(...)</dt><dd><tt><a href="#-radians">radians</a>(x)<br>
<br>
Convert angle x from degrees to radians.</tt></dd></dl>
<dl><dt><a name="-sin"><strong>sin</strong></a>(...)</dt><dd><tt><a href="#-sin">sin</a>(x)<br>
<br>
Return the sine of x (measured in radians).</tt></dd></dl>
<dl><dt><a name="-sinh"><strong>sinh</strong></a>(...)</dt><dd><tt><a href="#-sinh">sinh</a>(x)<br>
<br>
Return the hyperbolic sine of x.</tt></dd></dl>
<dl><dt><a name="-sqrt"><strong>sqrt</strong></a>(...)</dt><dd><tt><a href="#-sqrt">sqrt</a>(x)<br>
<br>
Return the square root of x.</tt></dd></dl>
<dl><dt><a name="-tan"><strong>tan</strong></a>(...)</dt><dd><tt><a href="#-tan">tan</a>(x)<br>
<br>
Return the tangent of x (measured in radians).</tt></dd></dl>
<dl><dt><a name="-tanh"><strong>tanh</strong></a>(...)</dt><dd><tt><a href="#-tanh">tanh</a>(x)<br>
<br>
Return the hyperbolic tangent of x.</tt></dd></dl>
<dl><dt><a name="-trunc"><strong>trunc</strong></a>(...)</dt><dd><tt><a href="#-trunc">trunc</a>(x:Real) -> Integral<br>
<br>
Truncates x to the nearest Integral toward 0. Uses the __trunc__ magic method.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>e</strong> = 2.718281828459045<br>
<strong>pi</strong> = 3.141592653589793</td></tr></table>
</body></html>
|