# Compute the Hyperbolic sine of the array elements in Python

PythonNumpyServer Side ProgrammingProgramming

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### Practical Machine Learning using Python

Best Seller

91 Lectures 23.5 hours

#### Practical Data Science using Python

22 Lectures 6 hours

To compute the Hyperbolic sine of the array elements, use the numpy.sinh() method in Python Numpy. The method is equivalent to 1/2 * (np.exp(x) - np.exp(-x)) or -1j * np.sin(1j*x). Returns the corresponding hyperbolic sine values. This is a scalar if x is a scalar. The 1st parameter, x is input array. The 2nd and 3rd parameters are optional.

The 2nd parameter is an ndarray, A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.

The 3rd parameter is the condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value.

## Steps

At first, import the required library −

import numpy as np

Get the Trigonometric Hyperbolic sine of the array elements. Create an array using the array() method in Numpy −

arr = np.array((0., 30., 45., 60., 90., 180., np.pi*1j/2, np.pi*1j))

Displaying our array −

print("Array...\n",arr)

Get the datatype −

print("\nArray datatype...\n",arr.dtype)

Get the dimensions of the Array −

print("\nArray Dimensions...\n",arr.ndim)

Get the number of elements of the Array −

print("\nNumber of elements in the Array...\n",arr.size)

To find the hyperbolic sines of the array elements, use the numpy.sinh() method in Python Numpy −

print("\nResult...",np.sinh(arr))

## Example

import numpy as np

# To compute the Hyperbolic sine of the array elements, use the numpy.sinh() method in Python Numpy
# The method is equivalent to 1/2 * (np.exp(x) - np.exp(-x)) or -1j * np.sin(1j*x).

print("Get the Trigonometric Hyperbolic sine of the array elements...")

# Create an array using the array() method in Numpy
arr = np.array((0., 30., 45., 60., 90., 180., np.pi*1j/2, np.pi*1j))

# Display the array
print("Array...\n", arr)

# Get the type of the array
print("\nOur Array type...\n", arr.dtype)

# Get the dimensions of the Array
print("\nOur Array Dimensions...\n",arr.ndim)

# Get the number of elements in the Array
print("\nNumber of elements...\n", arr.size)

# To find the hyperbolic sines of the array elements, use the numpy.sinh() method in Python Numpy
print("\nResult...",np.sinh(arr))

## Output

Get the Trigonometric Hyperbolic sine of the array elements...
Array...
[ 0.+0.j    30.+0.j    45.+0.j           60.+0.j
90.+0.j    180.+0.j    0.+1.57079633j    0.+3.14159265j]

Our Array type...
complex128

Our Array Dimensions...
1

Number of elements...
8

Result... [ 0.00000000e+00+0.0000000e+00j 5.34323729e+12+0.0000000e+00j
1.74671355e+19+0.0000000e+00j 5.71003695e+25+0.0000000e+00j
6.10201647e+38+0.0000000e+00j 7.44692100e+77+0.0000000e+00j
0.00000000e+00+1.0000000e+00j -0.00000000e+00+1.2246468e-16j]
Updated on 25-Feb-2022 06:26:39