Python Program for asinh() Function

In the previous article, we have discussed Python Program for acosh() Function
asinh() Function in Python:

The inverse hyperbolic sine of a number is returned by the math.asinh() method.

Syntax:

math.asinh(x)

Parameter:

x: This is required. It is a positive or a negative number. If x is not a number, a TypeError is returned.

Return Value:

Returns a float value representing a number’s inverse hyperbolic sine.

  • The asinh function returns the hyperbolic Arc Sine value if the number argument is positive or negative.
  • The asinh functions return TypeError if it is not a number.

Examples:

Example1:

Input:

Given first number = 9
Given second number = 45

Output:

The result after applying asinh() function on above given first number 9  =  2.8934439858858716
The result after applying asinh() function on above given second number 45  =  4.49993310426429

Example2:

Input:

Given first number = 30
Given second number = 60

Output:

The result after applying asinh() function on above given first number 30  =  4.09462222433053
The result after applying asinh() function on above given second number 60  =  4.78756117999381

Program for asinh() Function in Python

Method #1: Using Built-in Functions (Static Input)

Approach:

  • Import math module using the import keyword.
  • Give the list as static input and store it in a variable.
  • Give the first number as static input and store it in another variable.
  • Apply math.asinh() function to the given first number to get the inverse hyperbolic sine of a given number
  • Store it in another variable.
  • Print the above result.
  • Similarly, do the same for the other number.
  • Apply math.asinh() function to the given list element and print it.
  • The Exit of Program.

Below is the implementation:

# Import math module using the import keyword.
import math
# Give the list as static input and store it in a variable.
gvn_lst = [1, 4, 6, 3]
# Give the first number as static input and store it in another variable.
gvn_numb1 = 9
# Apply math.asinh() function to the given first number to get the inverse
# hyperbolic sine of a given number
# Store it in another variable.
fnl_rslt = math.asinh(gvn_numb1)
# Print the above result.
print("The result after applying asinh() function on above given first number",
      gvn_numb1, " = ", fnl_rslt)
# similarly do the same for the other number.
gvn_numb2 = 45
print("The result after applying asinh() function on above given second number",
      gvn_numb2, " = ", math.asinh(gvn_numb2))
# Apply math.asinh() function to the given list element and print it.
print(
    "The result after applying asinh() function on given list element gvnlst[1] = ", math.asinh(gvn_lst[1]))

Output:

The result after applying asinh() function on above given first number 9  =  2.8934439858858716
The result after applying asinh() function on above given second number 45  =  4.49993310426429
The result after applying asinh() function on given list element gvnlst[1] =  2.0947125472611012

Method #2: Using Built-in Functions (User Input)

Approach:

  • Import math module using the import keyword.
  • Give the list as user input using list(),map(),input(),and split() functions.
  • Store it in a variable.
  • Give the first number as user input using the float(input()) function and store it in a variable.
  • Apply math.asinh() function to the given first number to get the inverse hyperbolic sine of a given number
  • Store it in another variable.
  • Print the above result.
  • Similarly, do the same for the other number.
  • Apply math.asinh() function to the given list element and print it.
  • The Exit of Program.

Below is the implementation:

# Import math module using the import keyword.
import math
# Give the list as user input using list(),map(),input(),and split() functions.
# Store it in a variable.
gvn_lst = list(map(float, input(
    'Enter some random List Elements separated by spaces = ').split()))
# Give the first number as user input using the float(input()) function
# and store it in a variable.
gvn_numb1 = float(input("Enter some random number = "))
# Apply math.asinh() function to the given first number to get the inverse
# hyperbolic sine of a given number
# Store it in another variable.
fnl_rslt = math.asinh(gvn_numb1)
# Print the above result.
print("The result after applying asinh() function on above given first number",
      gvn_numb1, " = ", fnl_rslt)
# similarly do the same for the other number.
gvn_numb2 = float(input("Enter some random number = "))
print("The result after applying asinh() function on above given second number",
      gvn_numb2, " = ", math.asinh(gvn_numb2))
# Apply math.asinh() function to the given list element and print it.
print(
    "The result after applying asinh() function on given list element gvnlst[2] = ", math.asinh(gvn_lst[2]))

Output:

Enter some random List Elements separated by spaces = 15 25 35 45
Enter some random number = 30
The result after applying asinh() function on above given first number 30.0 = 4.09462222433053
Enter some random number = 60
The result after applying asinh() function on above given second number 60.0 = 4.78756117999381
The result after applying asinh() function on given list element gvnlst[2] = 4.248699261236361

Know all about Mathematical Functions in Python by going through our Python Mathematical Methods Examples well explained step by step.