Supported NumPy functions

The csdm object supports the use of NumPy functions, as

>>> y = np.func(x) 

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.

Trigonometric functions

The trigonometric functions apply to the components of the dependent variables from a csdm object.

Note

The components must be dimensionless quantities.

Table 1 A list of supported trigonometric functions.

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

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.

Table 2 A list of supported mathematical functions.

Functions

Description

exp

Calculate the exponential of the components of the dependent variables.

expm1

Apply \(e^x - 1\), where x are the components of the dependent variables.

exp2

Calculate \(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.

Table 3 Arithmetic operations

Functions

Description

reciprocal

Return element-wise reciprocal.

positive

Return element-wise numerical positive.

negative

Return element-wise numerical negative.

Table 4 Miscellaneous

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.

Table 5 Handling complex numbers

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.

Table 6 Sums, products, differences

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.

Table 7 Rounding

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