Math

Collection of math Ivy functions.

ivy.acos(x, f=None)[source]

Computes trigonometric inverse cosine element-wise. The inverse of cos so that, if y = cos(x), then x = arccos(y).

Parameters
  • x (array) – x-coordinate on the unit circle. For real arguments, the domain is [-1, 1].

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

The angle of the ray intersecting the unit circle at the given x-coordinate in radians [0, pi].

ivy.acosh(x, f=None)[source]

Returns a new array with the inverse hyperbolic cosine of the elements of x.

Parameters
  • x – Input array.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

A new array with the inverse hyperbolic cosine of the elements of x.

ivy.asin(x, f=None)[source]

Computes inverse sine element-wise.

Parameters
  • x (array) – y-coordinate on the unit circle.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

The inverse sine of each element in x, in radians and in the closed interval [-pi/2, pi/2].

ivy.asinh(x, f=None)[source]

Returns a new array with the inverse hyperbolic sine of the elements of x.

Parameters
  • x – Input array.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

A new array with the inverse hyperbolic sine of the elements of x.

ivy.atan(x, f=None)[source]

Computes trigonometric inverse tangent, element-wise. The inverse of tan, so that if y = tan(x) then x = arctan(y).

Parameters
  • x (array) – Input array.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

Out has the same shape as x. Its real part is in [-pi/2, pi/2] (arctan(+/-inf) returns +/-pi/2).

ivy.atan2(x1, x2, f=None)[source]

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

Parameters
  • x1 (array) – y-coordinates.

  • x2 (array) – x-coordinates. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

Array of angles in radians, in the range [-pi, pi].

ivy.atanh(x, f=None)[source]

Returns a new array with the inverse hyperbolic tangent of the elements of x.

Parameters
  • x – Input array.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

A new array with the inverse hyperbolic tangent of the elements of x.

ivy.cos(x, f=None)[source]

Computes trigonometric cosine element-wise.

Parameters
  • x (array) – Input array, in radians (2*pi radian equals 360 degrees).

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

The cosine of x element-wise.

ivy.cosh(x, f=None)[source]

Returns a new array with the hyperbolic cosine of the elements of x.

Parameters
  • x – Input array.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

A new array with the hyperbolic cosine of the elements of x.

ivy.exp(x, f=None)[source]

Computes exponential of x element-wise.

Parameters
  • x (array) – Value to compute exponential for.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

The exponential of each element of x.

ivy.log(x, f=None)[source]

Computes natural logarithm of x element-wise.

Parameters
  • x (array) – Value to compute log for.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

The natural logarithm of each element of x.

ivy.sin(x, f=None)[source]

Computes trigonometric sine element-wise.

Parameters
  • x (array) – Input array, in radians (2*pi radian equals 360 degrees).

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

The sine of x element-wise.

ivy.sinh(x, f=None)[source]

Returns a new array with the hyperbolic sine of the elements of x.

Parameters
  • x – Input array.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

A new array with the hyperbolic sine of the elements of x.

ivy.tan(x, f=None)[source]

Computes tangent element-wise. Equivalent to f.sin(x)/f.cos(x) element-wise.

Parameters
  • x (array) – Input array, in radians (2*pi radian equals 360 degrees).

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

The tangent of x element-wise.

ivy.tanh(x, f=None)[source]

Returns a new array with the hyperbolic tangent of the elements of x.

Parameters
  • x – Input array.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

A new array with the hyperbolic tangent of the elements of x.