# Mathematical Functions¶

## Trigonometric functions¶

cupy.sin = <ufunc 'cupy_sin'>

Elementwise sine function.

cupy.cos = <ufunc 'cupy_cos'>

Elementwise cosine function.

cupy.tan = <ufunc 'cupy_tan'>

Elementwise tangent function.

cupy.arcsin = <ufunc 'cupy_arcsin'>

Elementwise inverse-sine function (a.k.a. arcsine function).

cupy.arccos = <ufunc 'cupy_arccos'>

Elementwise inverse-cosine function (a.k.a. arccosine function).

cupy.arctan = <ufunc 'cupy_arctan'>

Elementwise inverse-tangent function (a.k.a. arctangent function).

cupy.hypot = <ufunc 'cupy_hypot'>

Computes the hypoteneous of orthogonal vectors of given length.

This is equivalent to sqrt(x1 **2 + x2 ** 2), while this function is more efficient.

cupy.arctan2 = <ufunc 'cupy_arctan2'>

Elementwise inverse-tangent of the ratio of two arrays.

cupy.deg2rad = <ufunc 'cupy_deg2rad'>

Converts angles from degrees to radians elementwise.

cupy.rad2deg = <ufunc 'cupy_rad2deg'>

Converts angles from radians to degrees elementwise.

cupy.degrees = <ufunc 'cupy_rad2deg'>

Converts angles from radians to degrees elementwise.

cupy.radians = <ufunc 'cupy_deg2rad'>

Converts angles from degrees to radians elementwise.

## Hyperbolic functions¶

cupy.sinh = <ufunc 'cupy_sinh'>

Elementwise hyperbolic sine function.

cupy.cosh = <ufunc 'cupy_cosh'>

Elementwise hyperbolic cosine function.

cupy.tanh = <ufunc 'cupy_tanh'>

Elementwise hyperbolic tangent function.

cupy.arcsinh = <ufunc 'cupy_arcsinh'>

Elementwise inverse of hyperbolic sine function.

cupy.arccosh = <ufunc 'cupy_arccosh'>

Elementwise inverse of hyperbolic cosine function.

cupy.arctanh = <ufunc 'cupy_arctanh'>

Elementwise inverse of hyperbolic tangent function.

## Rounding¶

cupy.rint = <ufunc 'cupy_rint'>

Rounds each element of an array to the nearest integer.

cupy.floor = <ufunc 'cupy_floor'>

Rounds each element of an array to its floor integer.

cupy.ceil = <ufunc 'cupy_ceil'>

Rounds each element of an array to its ceiling integer.

cupy.trunc = <ufunc 'cupy_trunc'>

Rounds each element of an array towards zero.

## Sums and products¶

cupy.sum(*args, **kwargs)[source]
cupy.prod(*args, **kwargs)[source]

## Exponential and logarithm functions¶

cupy.exp = <ufunc 'cupy_exp'>

Elementwise exponential function.

cupy.expm1 = <ufunc 'cupy_expm1'>

Computes exp(x) - 1 elementwise.

cupy.exp2 = <ufunc 'cupy_exp2'>

Elementwise exponentiation with base 2.

cupy.log = <ufunc 'cupy_log'>

Elementwise natural logarithm function.

cupy.log10 = <ufunc 'cupy_log10'>

Elementwise common logarithm function.

cupy.log2 = <ufunc 'cupy_log2'>

Elementwise binary logarithm function.

cupy.log1p = <ufunc 'cupy_log1p'>

Computes log(1 + x) elementwise.

cupy.logaddexp = <ufunc 'cupy_logaddexp'>

Computes log(exp(x1) + exp(x2)) elementwise.

cupy.logaddexp2 = <ufunc 'cupy_logaddexp2'>

Computes log2(exp2(x1) + exp2(x2)) elementwise.

## Floating point manipulations¶

cupy.signbit = <ufunc 'cupy_signbit'>

Tests elementwise if the sign bit is set (i.e. less than zero).

cupy.copysign = <ufunc 'cupy_copysign'>

Returns the first argument with the sign bit of the second elementwise.

cupy.ldexp = <ufunc 'cupy_ldexp'>

Computes x1 * 2 ** x2 elementwise.

cupy.frexp = <ufunc 'cupy_frexp'>

Decomposes each element to mantissa and two’s exponent.

This ufunc outputs two arrays of the input dtype and the int dtype.

cupy.nextafter = <ufunc 'cupy_nextafter'>

Computes the nearest neighbor float values towards the second argument.

numpy.nextafter

## Arithmetic operations¶

cupy.negative = <ufunc 'cupy_negative'>

Takes numerical negative elementwise.

cupy.add = <ufunc 'cupy_add'>

cupy.subtract = <ufunc 'cupy_subtract'>

Subtracts arguments elementwise.

cupy.multiply = <ufunc 'cupy_multiply'>

Multiplies two arrays elementwise.

cupy.divide = <ufunc 'cupy_true_divide'>

Elementwise true division (i.e. division as floating values).

cupy.true_divide = <ufunc 'cupy_true_divide'>

Elementwise true division (i.e. division as floating values).

cupy.floor_divide = <ufunc 'cupy_floor_divide'>

Elementwise floor division (i.e. integer quotient).

cupy.power = <ufunc 'cupy_power'>

Computes x1 ** x2 elementwise.

cupy.fmod = <ufunc 'cupy_fmod'>

Computes the remainder of C division elementwise.

cupy.mod = <ufunc 'cupy_remainder'>

Computes the remainder of Python division elementwise.

cupy.remainder = <ufunc 'cupy_remainder'>

Computes the remainder of Python division elementwise.

cupy.modf = <ufunc 'cupy_modf'>

Extracts the fractional and integral parts of an array elementwise.

This ufunc returns two arrays.

cupy.reciprocal = <ufunc 'cupy_reciprocal'>

Computes 1 / x elementwise.

## Miscellaneous¶

cupy.clip(*args, **kwargs)[source]
cupy.sqrt = <ufunc 'cupy_sqrt'>
cupy.square = <ufunc 'cupy_square'>

Elementwise square function.

cupy.absolute = <ufunc 'cupy_absolute'>

Elementwise absolute value function.

cupy.sign = <ufunc 'cupy_sign'>

Elementwise sign function.

It returns -1, 0, or 1 depending on the sign of the input.

cupy.maximum = <ufunc 'cupy_maximum'>

Takes the maximum of two arrays elementwise.

If NaN appears, it returns the NaN.

cupy.minimum = <ufunc 'cupy_minimum'>

Takes the minimum of two arrays elementwise.

If NaN appears, it returns the NaN.

cupy.fmax = <ufunc 'cupy_fmax'>

Takes the maximum of two arrays elementwise.

If NaN appears, it returns the other operand.

cupy.fmin = <ufunc 'cupy_fmin'>

Takes the minimum of two arrays elementwise.

If NaN appears, it returns the other operand.