Compute the inverse Hyperbolic sine in Python

PythonNumpyServer Side ProgrammingProgramming

The arcsinh is a multivalued function: for each x there are infinitely many numbers z such that sinh(z) = x. The convention is to return the z whose imaginary part lies in [-pi/2, pi/2]. For real-valued input data types, arcsinh always returns real output. For each value that cannot be expressed as a real number or infinity, it returns nan and sets the invalid floating point error flag. For complex-valued input, arccos is a complex analytical function that has branch cuts [1j, infj] and [-1j, -infj] and is continuous from the right on the former and from the left on the latter.

The inverse hyperbolic sine is also known as asinh or sinh^-1. To compute the inverse Hyperbolic sine, use the numpy.arcsinh() method in Python Numpy.The method returns the array of the same shape as x. 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 inverse Hyperbolic sine. Find arcsinh −

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

Finding arcsinh 90 degrees −

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

Finding arcsinh 60 degrees −

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

Finding arcsinh 45 degrees −

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

Finding arcsinh 30 degrees −

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

Finding arcsinh 0 degrees −

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

Finding arcsinh np.e −

print("\nResult...",np.arcsinh(np.e))

Example

import numpy as np

# To compute the inverse Hyperbolic sine, use the numpy.arcsinh() method in Python Numpy
# The method returns the array of the same shape as x. This is a scalar if x is a scalar.

print("Get the Trigonometric inverse Hyperbolic sine...")

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

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

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

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

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

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

# finding arcsinh np.e
print("\nResult...",np.arcsinh(np.e))

Output

Get the Trigonometric inverse Hyperbolic sine...

Result... (1.8115262724608532+1.5707963267948966j)

Result... 1.233403117511217

Result... 0.9143566553928859

Result... 0.7212254887267798

Result... 0.5022189850346115

Result... 0.0

Result... 1.725382558852315
raja
Updated on 25-Feb-2022 06:31:15

Advertisements