NumPy arcsinh() Function:
Numpy inverse sine: The NumPy arcsinh() function is used to compute the hyperbolic inverse sine of the array elements.
The inverse hyperbolic sine of x is calculated as follows:
Syntax:
numpy.arcsinh(array, out=None)
Parameters
array: The array items (in radians) for which the hyperbolic inverse sine values are to be computed.
out: This is optional.The output array’s shape.
Return value
The result is an array of hyperbolic inverse sine values.
NumPy arcsinh() Function in Python
Example#1: Using Built-in Functions (Static Input)
Approach:
- Import numpy module using the import keyword.
- Give the array as static input using the array() function by passing some random list of numbers as an argument to it.
- Store it in a variable.
- Calculate the inverse hyperbolic sine of values of the given array using the arcsinh() function and store it in another variable.
- Print the inverse hyperbolic sine of values of the given array.
- The Exit of the Program.
Below is the implementation:
# Import numpy module using the import keyword import numpy as np # Give the array as static input using the array() function by passing some # random list of numbers as an argument to it. # Store it in another variable gvn_arry = np.array([2, 5, 6, 1]) # Calculate the inverse hyperbolic sine of values of the given array # using the arcsinh() function and store it in another variable rslt= np.arcsinh(gvn_arry) # Print the inverse hyperbolic sine of values of the given array print("The inverse hyperbolic sine values of the given array = ") print(rslt)
Output:
The inverse hyperbolic sine values of the given array = [1.44363548 2.31243834 2.49177985 0.88137359]
Example#2: Using Built-in Functions (User Input)
Approach:
- Import numpy module using the import keyword.
- Give the list as user input using the list(),map(),split(),int functions and store it in a variable.
- Pass the above list as an argument to the array() function to get an array.
- Store it in another variable.
- Calculate the inverse hyperbolic sine of values of the given array using the arcsinh() function and store it in another variable.
- Print the inverse hyperbolic sine of values of the given array.
- The Exit of the Program.
Below is the implementation:
# Import numpy module using the import keyword import numpy as np # Give the list as user input using the list(),map(),split(),int functions # and store it in a variable. gvn_lst = list(map(int, input( 'Enter some random List Elements separated by spaces = ').split())) # Pass the above list as an argument to the array() function to get an array. # Store it in another variable gvn_arry = np.array(gvn_lst) # Calculate the inverse hyperbolic sine of values of the given array # using the arcsinh() function and store it in another variable rslt= np.arcsinh(gvn_arry) # Print the inverse hyperbolic sine of values of the given array print("The inverse hyperbolic sine values of the given array = ") print(rslt)
Output:
Enter some random List Elements separated by spaces = 3 7 8 1 The inverse hyperbolic sine values of the given array = [1.81844646 2.64412076 2.77647228 0.88137359]
Example#3: Using Built-in Functions (Static Input)
Approach:
- Import numpy module using the import keyword.
- Import math module using the import keyword.
- Give the array as static input using the array() function by passing some random list of numbers (get pi value using the math.pi) as an argument to it.
- Store it in a variable.
- Print the given array.
- Calculate the inverse hyperbolic sine of values of the given array using the arcsinh() function and store it in another variable.
- Print the inverse hyperbolic sine of values of the given array.
- The Exit of the Program.
Below is the implementation:
# Import numpy module using the import keyword import numpy as np # Import math module using the import keyword import math # Give the array as static input using the array() function by passing some # random list of elements(get pi value using the math.pi) as an argument to it. # Store it in a variable gvn_arry = np.array([0, math.pi/5, 4*math.pi/2, math.pi/8]) # Print the given array print("The given Array is:",gvn_arry) # Calculate the inverse hyperbolic sine of values of the given array # using the arcsinh() function and store it in another variable rslt = np.arcsinh(gvn_arry) # Print the inverse hyperbolic sine of values of the given array print("The inverse hyperbolic sine values of the given array = ") print(rslt)
Output:
The given Array is: [0. 0.62831853 6.28318531 0.39269908] The inverse hyperbolic sine values of the given array = [0. 0.5929557 2.5372975 0.38324809]