Compute the Hyperbolic sine in Python

PythonNumpyServer Side ProgrammingProgramming

To compute the Hyperbolic sine, 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. Find sinh −

print("\nResult...",np.sinh(np.pi*1j))

Finding sinh 90 degrees −

print("\nResult...",np.sinh(np.pi/2.))

Finding sinh 60 degrees −

print("\nResult...",np.sinh(np.pi/3.))

Finding sinh 45 degrees −

print("\nResult...",np.sinh(np.pi/4.))

Finding sinh 30 degrees −

print("\nResult...",np.sinh(np.pi/6.))

Finding sinh 0 degrees −

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

Example

import numpy as np

# To compute the Hyperbolic sine, 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...")

# find sinh
print("\nResult...",np.sinh(np.pi*1j))

# finding sinh 90 degrees
print("\nResult...",np.sinh(np.pi/2.))

# finding sinh 60 degrees
print("\nResult...",np.sinh(np.pi/3.))

# finding sinh 45 degrees
print("\nResult...",np.sinh(np.pi/4.))

# finding sinh 30 degrees
print("\nResult...",np.sinh(np.pi/6.))

# finding sinh 0 degrees
print("\nResult...",np.sinh(0))

Output

Get the Trigonometric Hyperbolic sine...

Result... (-0+1.2246467991473532e-16j)

Result... 2.3012989023072947

Result... 1.2493670505239751

Result... 0.8686709614860095

Result... 0.5478534738880397

Result... 0.0
raja
Updated on 28-Feb-2022 06:24:37

Advertisements