What is the numpy.sinh() function in Python?

Overview

The numpy.sinh() function in Python computes an input array x's hyperbolic sine, element-wise.

Mathematically:

sinh(x)=sinhxsinh(x) = sinhx

Also:

sinhx = (ex)(1/ex)2\frac{(e^x) - (1/e^x)}{2}

Syntax

numpy.sinh(x, /, out=None, *, where=True)

Parameter value

The numpy.sinh() function takes the following parameter values:

  • x (required): This represents the input array.
  • out (optional): This represents the location where the result is stored.
  • where (optional): This is the condition over which the input is being broadcast. At a given location where this condition is True, the resulting array will be set to the ufunc result. Otherwise, the resulting array will retain its original value. This is optional.
  • **kwargs (optional): This represents other keyword arguments. This is optional.

Return value

The numpy.sinh() function returns the corresponding hyperbolic sine values of each element in a given array.

Example

import numpy as np
# creating an array
x = np.array([30, 45, 60, 90, 180])
# taking the hyperbolic sine
myarray = np.sinh(x)
print(myarray)

Explanation

  • Line 1: We import the numpy module.
  • Line 4: We create an array, x, using the array() method.
  • Line 7: We implement the np.sinh() function on the array. The result is assigned to a variable, myarray.
  • Line 9: We print the myarray variable.

Free Resources