pytutorial/numpy/math_functions/README.md

63 lines
5.8 KiB
Markdown
Raw Normal View History

# [Mathematical functions](https://numpy.org/doc/stable/reference/routines.math.html)
**I will focus on the important ones.**
## [Trigonometric functions](https://numpy.org/doc/stable/reference/routines.math.html#trigonometric-functions)
|||
|---|---|
|[sin](https://numpy.org/doc/stable/reference/generated/numpy.sin.html#numpy.sin)(x, /[, out, where, casting, order, ...])|Trigonometric sine, element-wise.|
|[cos](https://numpy.org/doc/stable/reference/generated/numpy.cos.html#numpy.cos)(x, /[, out, where, casting, order, ...])|Cosine element-wise.|
|[tan](https://numpy.org/doc/stable/reference/generated/numpy.tan.html#numpy.tan)(x, /[, out, where, casting, order, ...])|Compute tangent element-wise.|
|[arcsin](https://numpy.org/doc/stable/reference/generated/numpy.arcsin.html#numpy.arcsin)(x, /[, out, where, casting, order, ...])|Inverse sine, element-wise.|
|[arccos](https://numpy.org/doc/stable/reference/generated/numpy.arccos.html#numpy.arccos)(x, /[, out, where, casting, order, ...])|Trigonometric inverse cosine, element-wise.|
|arctan(x, /[, out, where, casting, order, ...])|Trigonometric inverse tangent, element-wise.|
|hypot(x1, x2, /[, out, where, casting, ...])|Given the "legs" of a right triangle, return its hypotenuse.|
|[arctan2](https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html#numpy.arctan2)(x1, x2, /[, out, where, casting, ...])|Element-wise arc tangent of x1/x2 choosing the quadrant correctly.|
|degrees(x, /[, out, where, casting, order, ...])|Convert angles from radians to degrees.|
|radians(x, /[, out, where, casting, order, ...])|Convert angles from degrees to radians.|
|unwrap(p[, discont, axis, period])|Unwrap by taking the complement of large deltas with respect to the period.|
|deg2rad(x, /[, out, where, casting, order, ...])|Convert angles from degrees to radians.|
|rad2deg(x, /[, out, where, casting, order, ...])|Convert angles from radians to degrees.|
## [Hyperbolic functions](https://numpy.org/doc/stable/reference/routines.math.html#hyperbolic-functions)
|||
|---|---|
|sinh(x, /[, out, where, casting, order, ...]) |Hyperbolic sine, element-wise.|
|cosh(x, /[, out, where, casting, order, ...]) |Hyperbolic cosine, element-wise.|
|tanh(x, /[, out, where, casting, order, ...]) |Compute hyperbolic tangent element-wise.|
|arcsinh(x, /[, out, where, casting, order, ...]) |Inverse hyperbolic sine element-wise.|
|arccosh(x, /[, out, where, casting, order, ...]) |Inverse hyperbolic cosine, element-wise.|
|arctanh(x, /[, out, where, casting, order, ...]) |Inverse hyperbolic tangent element-wise.|
## [Rounding](https://numpy.org/doc/stable/reference/routines.math.html#rounding)
|||
|---|---|
|[round](https://numpy.org/doc/stable/reference/generated/numpy.round.html#numpy.round)(a[, decimals, out])|Evenly round to the given number of decimals.|
|[around](https://numpy.org/doc/stable/reference/generated/numpy.around.html#numpy.around)(a[, decimals, out])|Round an array to the given number of decimals.|
|[rint](https://numpy.org/doc/stable/reference/generated/numpy.rint.html#numpy.rint)(x, /[, out, where, casting, order, ...])|Round elements of the array to the nearest integer.|
|[fix](https://numpy.org/doc/stable/reference/generated/numpy.fix.html#numpy.fix)(x[, out])|Round to nearest integer towards zero.|
|[floor](https://numpy.org/doc/stable/reference/generated/numpy.floor.html#numpy.floor)(x, /[, out, where, casting, order, ...])|Return the floor of the input, element-wise.|
|[ceil](https://numpy.org/doc/stable/reference/generated/numpy.ceil.html#numpy.ceil)(x, /[, out, where, casting, order, ...])|Return the ceiling of the input, element-wise.|
|[trunc](https://numpy.org/doc/stable/reference/generated/numpy.trunc.html#numpy.trunc)(x, /[, out, where, casting, order, ...])|Return the truncated value of the input, element-wise.|
## [Sums, products, differences](https://numpy.org/doc/stable/reference/routines.math.html#sums-products-differences)
|||
|---|---|
|[prod](https://numpy.org/doc/stable/reference/generated/numpy.prod.html#numpy.prod)(a[, axis, dtype, out, keepdims, ...]) |Return the product of array elements over a given axis.|
|[sum](https://numpy.org/doc/stable/reference/generated/numpy.sum.html#numpy.sum)(a[, axis, dtype, out, keepdims, ...])|Sum of array elements over a given axis.|
|[nanprod](https://numpy.org/doc/stable/reference/generated/numpy.nanprod.html#numpy.nanprod)(a[, axis, dtype, out, keepdims, ...])|Return the product of array elements over a given axis treating Not a Numbers (NaNs) as ones.|
|[nansum](https://numpy.org/doc/stable/reference/generated/numpy.nansum.html#numpy.nansum)(a[, axis, dtype, out, keepdims, ...])|Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero.|
|[cumprod](https://numpy.org/doc/stable/reference/generated/numpy.cumprod.html#numpy.cumprod)(a[, axis, dtype, out])|Return the cumulative product of elements along a given axis.|
|[cumsum](https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html#numpy.cumsum)(a[, axis, dtype, out])|Return the cumulative sum of the elements along a given axis.|
|[nancumprod](https://numpy.org/doc/stable/reference/generated/numpy.nancumprod.html#numpy.nancumprod)(a[, axis, dtype, out])|Return the cumulative product of array elements over a given axis treating Not a Numbers (NaNs) as one.|
|[nancumsum](https://numpy.org/doc/stable/reference/generated/numpy.nancumsum.html#numpy.nancumsum)(a[, axis, dtype, out])|Return the cumulative sum of array elements over a given axis treating Not a Numbers (NaNs) as zero.|
|[diff](https://numpy.org/doc/stable/reference/generated/numpy.diff.html#numpy.diff)(a[, n, axis, prepend, append])|Calculate the n-th discrete difference along the given axis.|
|[cross](https://numpy.org/doc/stable/reference/generated/numpy.cross.html#numpy.cross)(a, b[, axisa, axisb, axisc, axis])|Return the cross product of two (arrays of) vectors.|