Mathematical functions (mygrad.math)#

Trigonometric functions#

sin(x[, out, where, dtype, constant])

Trigonometric sine, element-wise.

cos(x[, out, where, dtype, constant])

Trigonometric cosine, element-wise.

tan(x[, out, where, dtype, constant])

Trigonometric tangent, element-wise.

arcsin(x[, out, where, dtype, constant])

Inverse sine, element-wise.

arccos(x[, out, where, dtype, constant])

Inverse cosine, element-wise.

arctan(x[, out, where, dtype, constant])

Inverse tangent, element-wise.

arctan2(x1, x2[, out, where, dtype, constant])

Element-wise arc tangent of x1/x2 choosing the quadrant correctly.

Hyperbolic functions#

sinh(x[, out, where, dtype, constant])

Hyperbolic sine, element-wise.

cosh(x[, out, where, dtype, constant])

Hyperbolic cosine, element-wise.

tanh(x[, out, where, dtype, constant])

Hyperbolic tangent, element-wise.

arcsinh(x[, out, where, dtype, constant])

Inverse hyperbolic sine, element-wise.

arccosh(x[, out, where, dtype, constant])

Inverse hyperbolic cosine, element-wise.

arctanh(x[, out, where, dtype, constant])

Inverse hyperbolic tangent, element-wise.

Sums, products, differences#

prod(a[, axis, keepdims, constant])

Return the product of array elements over given axes.

sum(x[, axis, keepdims, constant])

Sum of tensor elements over a given axis.

cumprod(a[, axis, constant])

Return the cumulative product of elements along a given axis.

cumsum(a[, axis, constant])

Return the cumulative sum of the elements along a given axis.

mean(x[, axis, keepdims, constant])

Mean of tensor elements over a given axis.

var(x[, axis, ddof, keepdims, constant])

Compute the variance along the specified axis.

std(x[, axis, ddof, keepdims, constant])

Compute the standard deviation along the specified axis.

amax(x[, axis, keepdims, constant])

Return the maximum of a tensor or maximum along its axes.

amin(x[, axis, keepdims, constant])

Return the minimum of a tensor or minimum along its axes.

max(x[, axis, keepdims, constant])

Return the maximum of a tensor or maximum along its axes.

min(x[, axis, keepdims, constant])

Return the minimum of a tensor or minimum along its axes.

Exponents and logarithms#

exp(x1[, out, where, dtype, constant])

Calculate the exponential of all elements in the input tensor.

expm1(x1[, out, where, dtype, constant])

Calculate exp(x) - 1 for all elements in the tensor.

exp2(x1[, out, where, dtype, constant])

Calculate 2**p for all p in the input tensor.

log(x1[, out, where, dtype, constant])

Natural logarithm, element-wise.

log10(x1[, out, where, dtype, constant])

Return the base 10 logarithm of the input tensor, element-wise.

log2(x1[, out, where, dtype, constant])

Base-2 logarithm applied elementwise to the tensor.

log1p(x1[, out, where, dtype, constant])

Return the natural logarithm of one plus the input tensor, element-wise.

logaddexp(x1, x2[, out, where, dtype, constant])

Logarithm of the sum of exponentiations of the inputs.

logaddexp2(x1, x2[, out, where, dtype, constant])

Logarithm of the sum of exponentiations of the inputs in base-2.

Other special functions#

add_sequence(*variables[, constant])

f(a, b, ...) -> a + b + ...

multiply_sequence(*variables[, constant])

f(a, b, ...) -> a * b * ...

sinc(a, *[, constant])

f(a) -> sin(a) / a

Arithmetic operations#

add(x1, x2[, out, where, dtype, constant])

Add the arguments element-wise.

reciprocal(x[, out, where, dtype, constant])

Return the reciprocal of the argument element-wise.

positive(x[, out, where, dtype, constant])

Returns a copy of the tensor.

negative(x[, out, where, dtype, constant])

Negates the tensor element-wise.

multiply(x1, x2[, out, where, dtype, constant])

Multiply the arguments element-wise.

divide

alias of true_divide

power(x1, x2[, out, where, dtype, constant])

First tensor elements raised to powers from second tensor, element-wise.

subtract(x1, x2[, out, where, dtype, constant])

Subtract the arguments element-wise.

Miscellaneous#

clip(a, a_min, a_max[, out, constant])

Clip (limit) the values in an array.

sqrt(x[, out, where, dtype, constant])

The square root, elementwise.

cbrt(x[, out, where, dtype, constant])

The cube root elementwise.

square(x[, out, where, dtype, constant])

Return the square of the argument element-wise.

absolute(x[, out, where, dtype, constant, ...])

The absolute value, computed elementwise.

maximum(x1, x2[, out, where, dtype, constant])

Pair-wise maximum of tensor elements.

minimum(x1, x2[, out, where, dtype, constant])

Pair-wise minimum of tensor elements.