.. _numpy_support: Supported NumPy functions ------------------------- The csdm object supports the use of NumPy functions, as >>> y = np.func(x) # doctest: +SKIP where ``x`` and ``y`` are the csdm objects, and ``func`` is any one of the following functions. These functions apply to each component of the dependent variables from a given `csdm` object, `x`. .. rubric:: Trigonometric functions The trigonometric functions apply to the components of the dependent variables from a csdm object. .. note:: The components must be dimensionless quantities. .. cssclass:: table-bordered table-striped centered .. list-table:: A list of supported trigonometric functions. :widths: 25 75 :header-rows: 1 * - Functions - Description * - `sin `_ - Apply sine to the components of the dependent variables * - `cos `_ - Apply cosine to the components of the dependent variables * - `tan `_ - Apply tangent to the components of the dependent variables * - `arcsin `_ - Apply inverse sine to the components of the dependent variables * - `arccos `_ - Apply inverse cosine to the components of the dependent variables * - `arctan `_ - Apply inverse tangent to the components of the dependent variables * - `sinh `_ - Apply hyperbolic sine to the components of the dependent variables * - `cosh `_ - Apply hyperbolic cosine to the components of the dependent variables * - `tanh `_ - Apply hyperbolic tangent to the components of the dependent variables * - `arcsinh `_ - Apply inverse hyperbolic sine to the components of the dependent variables * - `arccosh `_ - Apply inverse hyperbolic cosine to the components of the dependent variables * - `arctanh `_ - Apply inverse hyperbolic tangent to the components of the dependent variables .. rubric:: Mathematical operations The following mathematical functions apply to the components of the dependent variables from a csdm object. .. note:: The components must be dimensionless quantities. .. cssclass:: table-bordered table-striped centered .. list-table:: A list of supported mathematical functions. :widths: 25 75 :header-rows: 1 * - Functions - Description * - `exp `_ - Calculate the exponential of the components of the dependent variables. * - `expm1 `_ - Apply :math:`e^x - 1`, where `x` are the components of the dependent variables. * - `exp2 `_ - Calculate :math:`2^x`, where `x` are the components of the dependent variables. * - `log `_ - Calculate natural logarithm of the components of the dependent variables. * - `log1p `_ - Calculate natural logarithm plus one on the components of the dependent variables. * - `log2 `_ - Calculate base-2 logarithm of the components of the dependent variables. * - `log10 `_ - Calculate base-10 logarithm of the components of the dependent variables. The following mathematical functions apply to the components of the dependent variables from a csdm object irrespective of the components' dimensionality. .. cssclass:: table-bordered table-striped centered .. list-table:: Arithmetic operations :widths: 25 75 :header-rows: 1 * - Functions - Description * - `reciprocal `_ - Return element-wise reciprocal. * - `positive `_ - Return element-wise numerical positive. * - `negative `_ - Return element-wise numerical negative. .. cssclass:: table-bordered table-striped centered .. list-table:: Miscellaneous :widths: 25 75 :header-rows: 1 * - Functions - Description * - `sqrt `_ - Return element-wise non-negative square-root. * - `cbrt `_ - Return element-wise cube-root. * - `square `_ - Return element-wise square. * - `absolute `_ - Return element-wise absolute value. * - `fabs `_ - Return element-wise absolute value. * - `sign `_ - Return element-wise sign of the values. .. * - `clip `_ .. - Clip the values between the limits. .. cssclass:: table-bordered table-striped centered .. list-table:: Handling complex numbers :widths: 25 75 :header-rows: 1 * - Functions - Description * - `angle `_ - Return element-wise angle of a complex value. * - `real `_ - Return element-wise real part of a complex value. * - `imag `_ - Return element-wise imaginary part of a complex value.å * - `conj `_ - Return element-wise conjugate. * - `conjugate `_ - Return element-wise conjugate. .. cssclass:: table-bordered table-striped centered .. list-table:: Sums, products, differences :widths: 25 75 :header-rows: 1 * - Functions - Description * - `prod `_ - Return the product of the components of a dependent variable along a dimension. * - `sum `_ - Return the sum of the components of a dependent variable along a dimension. .. cssclass:: table-bordered table-striped centered .. list-table:: Rounding :widths: 25 75 :header-rows: 1 * - Functions - Description * - `rint `_ - Round elements to the nearest integer. * - `around `_ - Round elements to the given number of decimals. * - `round `_ - Round elements to the given number of decimals. Other functions - min - max - mean - var - std