Home » Python

math.asinh() method with example in Python

Python math.asinh() method: Here, we are going to learn about the math.asinh() method with example in Python.
Submitted by IncludeHelp, on April 23, 2019

Python math.asinh() method

math.asinh() method is a library method of math module, it is used to get the hyperbolic arc sine of given number in radians, it accepts a number and returns hyperbolic arc sine.

Note: math.asinh() method accepts only numbers, if we provide anything else except the number, it returns error TypeError"TypeError: a float is required".

Syntax of math.asinh() method:

    math.asinh(x)

Parameter(s): x – is the number whose hyperbolic arc sine to be calculated.

Return value: float – it returns a float value that is the hyperbolic arc sine value of the number x.

Example:

    Input:
    x = 1.5

    # function call
    print(math.asinh(x))

    Output:
    1.1947632172871094

Python code to demonstrate example of math.asinh() method

# Python code to demonstrate example of 
# math.asinh() method

# importing math module
import math 

# number 
x = -10
print("math.asinh(",x,"): ", math.asinh(x))

x = -10.23
print("math.asinh(",x,"): ", math.asinh(x))

x = 0
print("math.asinh(",x,"): ", math.asinh(x))


x = 1
print("math.asinh(",x,"): ", math.asinh(x))

x = 1.5
print("math.asinh(",x,"): ", math.asinh(x))

x = 5
print("math.asinh(",x,"): ", math.asinh(x))

x = 15.45
print("math.asinh(",x,"): ", math.asinh(x))

Output

math.asinh( -10 ):  -2.99822295029797
math.asinh( -10.23 ):  -3.020852095014173
math.asinh( 0 ):  0.0
math.asinh( 1 ):  0.881373587019543
math.asinh( 1.5 ):  1.1947632172871094
math.asinh( 5 ):  2.3124383412727525
math.asinh( 15.45 ):  3.4318018711641196

TypeError example

# Python code to demonstrate example of 
# math.asinh() method with exception

# importing math module
import math 

# number 
x = "2.5"
print("math.asinh(",x,"): ", math.asinh(x))

Output

Traceback (most recent call last):
  File "/home/main.py", line 9, in <module>
    print("math.asinh(",x,"): ", math.asinh(x))
TypeError: a float is required


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.