File Doc/library/cmath.rst changed (mode: 100644) (index c819a667ec..9d81730f20) |
... |
... |
rectangular coordinates to polar coordinates and back. |
47 |
47 |
|
|
48 |
48 |
Return the phase of *x* (also known as the *argument* of *x*), as a |
Return the phase of *x* (also known as the *argument* of *x*), as a |
49 |
49 |
float. ``phase(x)`` is equivalent to ``math.atan2(x.imag, |
float. ``phase(x)`` is equivalent to ``math.atan2(x.imag, |
50 |
|
x.real)``. The result lies in the range [-π, π], and the branch |
|
|
50 |
|
x.real)``. The result lies in the range [-\ *π*, *π*], and the branch |
51 |
51 |
cut for this operation lies along the negative real axis, |
cut for this operation lies along the negative real axis, |
52 |
52 |
continuous from above. On systems with support for signed zeros |
continuous from above. On systems with support for signed zeros |
53 |
53 |
(which includes most systems in current use), this means that the |
(which includes most systems in current use), this means that the |
|
... |
... |
Power and logarithmic functions |
86 |
86 |
|
|
87 |
87 |
.. function:: exp(x) |
.. function:: exp(x) |
88 |
88 |
|
|
89 |
|
Return the exponential value ``e**x``. |
|
|
89 |
|
Return *e* raised to the power *x*, where *e* is the base of natural |
|
90 |
|
logarithms. |
90 |
91 |
|
|
91 |
92 |
|
|
92 |
93 |
.. function:: log(x[, base]) |
.. function:: log(x[, base]) |
|
... |
... |
Classification functions |
243 |
244 |
Constants |
Constants |
244 |
245 |
--------- |
--------- |
245 |
246 |
|
|
246 |
|
|
|
247 |
247 |
.. data:: pi |
.. data:: pi |
248 |
248 |
|
|
249 |
249 |
The mathematical constant *π*, as a float. |
The mathematical constant *π*, as a float. |
|
... |
... |
Constants |
253 |
253 |
|
|
254 |
254 |
The mathematical constant *e*, as a float. |
The mathematical constant *e*, as a float. |
255 |
255 |
|
|
|
256 |
|
|
256 |
257 |
.. data:: tau |
.. data:: tau |
257 |
258 |
|
|
258 |
259 |
The mathematical constant *τ*, as a float. |
The mathematical constant *τ*, as a float. |
259 |
260 |
|
|
260 |
261 |
.. versionadded:: 3.6 |
.. versionadded:: 3.6 |
261 |
262 |
|
|
|
263 |
|
|
262 |
264 |
.. data:: inf |
.. data:: inf |
263 |
265 |
|
|
264 |
266 |
Floating-point positive infinity. Equivalent to ``float('inf')``. |
Floating-point positive infinity. Equivalent to ``float('inf')``. |
265 |
267 |
|
|
266 |
268 |
.. versionadded:: 3.6 |
.. versionadded:: 3.6 |
267 |
269 |
|
|
|
270 |
|
|
268 |
271 |
.. data:: infj |
.. data:: infj |
269 |
272 |
|
|
270 |
273 |
Complex number with zero real part and positive infinity imaginary |
Complex number with zero real part and positive infinity imaginary |
|
... |
... |
Constants |
272 |
275 |
|
|
273 |
276 |
.. versionadded:: 3.6 |
.. versionadded:: 3.6 |
274 |
277 |
|
|
|
278 |
|
|
275 |
279 |
.. data:: nan |
.. data:: nan |
276 |
280 |
|
|
277 |
281 |
A floating-point "not a number" (NaN) value. Equivalent to |
A floating-point "not a number" (NaN) value. Equivalent to |
|
... |
... |
Constants |
279 |
283 |
|
|
280 |
284 |
.. versionadded:: 3.6 |
.. versionadded:: 3.6 |
281 |
285 |
|
|
|
286 |
|
|
282 |
287 |
.. data:: nanj |
.. data:: nanj |
283 |
288 |
|
|
284 |
289 |
Complex number with zero real part and NaN imaginary part. Equivalent to |
Complex number with zero real part and NaN imaginary part. Equivalent to |
File Doc/library/math.rst changed (mode: 100644) (index 0c53b294a9..9e4946323a) |
... |
... |
Number-theoretic and representation functions |
42 |
42 |
*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` |
*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` |
43 |
43 |
returns *-1.0*. |
returns *-1.0*. |
44 |
44 |
|
|
|
45 |
|
|
45 |
46 |
.. function:: fabs(x) |
.. function:: fabs(x) |
46 |
47 |
|
|
47 |
48 |
Return the absolute value of *x*. |
Return the absolute value of *x*. |
48 |
49 |
|
|
|
50 |
|
|
49 |
51 |
.. function:: factorial(x) |
.. function:: factorial(x) |
50 |
52 |
|
|
51 |
53 |
Return *x* factorial. Raises :exc:`ValueError` if *x* is not integral or |
Return *x* factorial. Raises :exc:`ValueError` if *x* is not integral or |
52 |
54 |
is negative. |
is negative. |
53 |
55 |
|
|
|
56 |
|
|
54 |
57 |
.. function:: floor(x) |
.. function:: floor(x) |
55 |
58 |
|
|
56 |
59 |
Return the floor of *x*, the largest integer less than or equal to *x*. |
Return the floor of *x*, the largest integer less than or equal to *x*. |
|
... |
... |
Power and logarithmic functions |
220 |
223 |
|
|
221 |
224 |
.. function:: exp(x) |
.. function:: exp(x) |
222 |
225 |
|
|
223 |
|
Return e raised to the power *x*, where e = 2.718281... is the base |
|
224 |
|
of natural logarithms. |
|
|
226 |
|
Return *e* raised to the power *x*, where *e* = 2.718281... is the base |
|
227 |
|
of natural logarithms. This is usually more accurate than ``math.e ** x`` |
|
228 |
|
or ``pow(math.e, x)``. |
|
229 |
|
|
225 |
230 |
|
|
226 |
231 |
.. function:: expm1(x) |
.. function:: expm1(x) |
227 |
232 |
|
|
228 |
|
Return ``e**x - 1``. For small floats *x*, the subtraction in ``exp(x) - 1`` |
|
|
233 |
|
Return *e* raised to the power *x*, minus 1. Here *e* is the base of natural |
|
234 |
|
logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` |
229 |
235 |
can result in a `significant loss of precision |
can result in a `significant loss of precision |
230 |
236 |
<https://en.wikipedia.org/wiki/Loss_of_significance>`_\; the :func:`expm1` |
<https://en.wikipedia.org/wiki/Loss_of_significance>`_\; the :func:`expm1` |
231 |
237 |
function provides a way to compute this quantity to full precision:: |
function provides a way to compute this quantity to full precision:: |
|
... |
... |
Power and logarithmic functions |
290 |
296 |
|
|
291 |
297 |
Return the square root of *x*. |
Return the square root of *x*. |
292 |
298 |
|
|
|
299 |
|
|
293 |
300 |
Trigonometric functions |
Trigonometric functions |
294 |
301 |
----------------------- |
----------------------- |
295 |
302 |
|
|
296 |
|
|
|
297 |
303 |
.. function:: acos(x) |
.. function:: acos(x) |
298 |
304 |
|
|
299 |
305 |
Return the arc cosine of *x*, in radians. |
Return the arc cosine of *x*, in radians. |
|
... |
... |
Trigonometric functions |
339 |
345 |
|
|
340 |
346 |
Return the tangent of *x* radians. |
Return the tangent of *x* radians. |
341 |
347 |
|
|
|
348 |
|
|
342 |
349 |
Angular conversion |
Angular conversion |
343 |
350 |
------------------ |
------------------ |
344 |
351 |
|
|
345 |
|
|
|
346 |
352 |
.. function:: degrees(x) |
.. function:: degrees(x) |
347 |
353 |
|
|
348 |
354 |
Convert angle *x* from radians to degrees. |
Convert angle *x* from radians to degrees. |
|
... |
... |
Angular conversion |
352 |
358 |
|
|
353 |
359 |
Convert angle *x* from degrees to radians. |
Convert angle *x* from degrees to radians. |
354 |
360 |
|
|
|
361 |
|
|
355 |
362 |
Hyperbolic functions |
Hyperbolic functions |
356 |
363 |
-------------------- |
-------------------- |
357 |
364 |
|
|
|
... |
... |
Constants |
440 |
447 |
|
|
441 |
448 |
.. data:: pi |
.. data:: pi |
442 |
449 |
|
|
443 |
|
The mathematical constant π = 3.141592..., to available precision. |
|
|
450 |
|
The mathematical constant *π* = 3.141592..., to available precision. |
444 |
451 |
|
|
445 |
452 |
|
|
446 |
453 |
.. data:: e |
.. data:: e |
447 |
454 |
|
|
448 |
|
The mathematical constant e = 2.718281..., to available precision. |
|
|
455 |
|
The mathematical constant *e* = 2.718281..., to available precision. |
|
456 |
|
|
449 |
457 |
|
|
450 |
458 |
.. data:: tau |
.. data:: tau |
451 |
459 |
|
|
452 |
|
The mathematical constant τ = 6.283185..., to available precision. |
|
453 |
|
Tau is a circle constant equal to 2π, the ratio of a circle's circumference to |
|
|
460 |
|
The mathematical constant *τ* = 6.283185..., to available precision. |
|
461 |
|
Tau is a circle constant equal to 2\ *π*, the ratio of a circle's circumference to |
454 |
462 |
its radius. To learn more about Tau, check out Vi Hart's video `Pi is (still) |
its radius. To learn more about Tau, check out Vi Hart's video `Pi is (still) |
455 |
463 |
Wrong <https://www.youtube.com/watch?v=jG7vhMMXagQ>`_, and start celebrating |
Wrong <https://www.youtube.com/watch?v=jG7vhMMXagQ>`_, and start celebrating |
456 |
464 |
`Tau day <http://tauday.com/>`_ by eating twice as much pie! |
`Tau day <http://tauday.com/>`_ by eating twice as much pie! |
457 |
465 |
|
|
458 |
466 |
.. versionadded:: 3.6 |
.. versionadded:: 3.6 |
459 |
467 |
|
|
|
468 |
|
|
460 |
469 |
.. data:: inf |
.. data:: inf |
461 |
470 |
|
|
462 |
471 |
A floating-point positive infinity. (For negative infinity, use |
A floating-point positive infinity. (For negative infinity, use |
File Doc/whatsnew/3.6.rst changed (mode: 100644) (index a696af4a99..163794da96) |
... |
... |
return value. |
908 |
908 |
cmath |
cmath |
909 |
909 |
----- |
----- |
910 |
910 |
|
|
911 |
|
The new :const:`cmath.tau` (τ) constant has been added. |
|
|
911 |
|
The new :const:`cmath.tau` (*τ*) constant has been added. |
912 |
912 |
(Contributed by Lisa Roach in :issue:`12345`, see :pep:`628` for details.) |
(Contributed by Lisa Roach in :issue:`12345`, see :pep:`628` for details.) |
913 |
913 |
|
|
914 |
914 |
New constants: :const:`cmath.inf` and :const:`cmath.nan` to |
New constants: :const:`cmath.inf` and :const:`cmath.nan` to |
|
... |
... |
be reopened. |
1199 |
1199 |
math |
math |
1200 |
1200 |
---- |
---- |
1201 |
1201 |
|
|
1202 |
|
The tau (τ) constant has been added to the :mod:`math` and :mod:`cmath` |
|
|
1202 |
|
The tau (*τ*) constant has been added to the :mod:`math` and :mod:`cmath` |
1203 |
1203 |
modules. |
modules. |
1204 |
1204 |
(Contributed by Lisa Roach in :issue:`12345`, see :pep:`628` for details.) |
(Contributed by Lisa Roach in :issue:`12345`, see :pep:`628` for details.) |
1205 |
1205 |
|
|