AppDividend
Latest Code Tutorials

# Python asinh() Function | Math.asinh() in Python Example

Python asinh() is an inbuilt method that is defined under the math module, which is used to find the hyperbolic arcsine of the given parameter in radians. For instance, if x is passed as a parameter in asinh Function (asinh(x)), it returns the hyperbolic arcsine value. To work with Python asinh() function, we need to write import math at the head of the file. After importing, we use to call the asinh() function using the static object.

## Python asinh()

Content Overview

Python asinh() method is one of the Python Math function that calculates the Trigonometric Hyperbolic ArcSine for the specified expression or number. Python asinh() method also called the inverse of hyperbolic sine.

Another important point to note is that math asinh() function only takes parameter values of number type if any other type is passed; it returns type error.

### Syntax

```math.asinh(var)
```

Here var is the variable of which hyperbolic sine arc we have to find.

### Parameters

It takes one parameter var, which takes values of the numeric datatype and throws TypeError if the argument is of any other data type is passed.

### Return Value

It returns the hyperbolic arc sine value of the number in the float datatype. If the number argument is the positive or negative number, the asinh() function returns the hyperbolic arcsine value. If it is not the number, the asinh() functions return TypeError.

See the following code.

```import math

var = 2
print(math.asinh(var))
```

### Example programs on asinh() method in Python

#### Example 1: Write a program to show the working of the asinh() method in Python.

```import math

a1 = 3.5
b1 = 1
c1 = 7
d1 = 5.3

print("Value for parameter ", a1, " is ", math.asinh(a1))
print("Value for parameter ", b1, " is ", math.asinh(b1))
print("Value for parameter ", c1, " is ", math.asinh(c1))
print("Value for parameter ", d1, " is ", math.asinh(d1))
```

#### Output

```Value for parameter  3.5  is  1.9657204716496515
Value for parameter  1  is  0.8813735870195429
Value for parameter  7  is  2.644120761058629
Value for parameter  5.3  is  2.3696374478085054
```

In this example, we have seen that bypassing the valid parameter which is different for different examples, we get the desired asinh() method solution, which is the hyperbolic sine value of the parameter.

#### Example 2: Write the program to pass a value out of range from the asinh() Function and display the output.

See the following code.

```import math

q = "H"
print(math.asinh(q))
```

#### Output

```TypeError: must be real number, not str
```

In this example, we’ve seen that by passing a parameter which is not of number type, the Function throws an error.

## Python asinh() with list and tuple

In the asinh() function, we are going to find Hyperbolic ArcSine values of different data types like Python list and tuple to display the output.

```# app.py

import math

Tup = (21, 11, 30, -40, 50)
Lis = [-25, 35, -42.5, -55.85, 25.84]

print("Python Hyperbolic ArcSine of Positive Number = %.2f" % math.asinh(21))
print("Python Hyperbolic ArcSine of Negative Number = %.2f" % math.asinh(-11))

print("Python Hyperbolic ArcSine of Tuple Item = %.2f" % math.asinh(Tup))
print("Python Hyperbolic ArcSine of List Item = %.2f" % math.asinh(Lis))

print("Python Hyperbolic ArcSine of Multiple Numbers = %.2f" %
math.asinh(22 + 49 - 27))

print("Python Hyperbolic Arc Sine of String Value = ", math.asinh('AppDividend'))```

#### Output

```python3 app.py
Python Hyperbolic ArcSine of Positive Number = 3.74
Python Hyperbolic ArcSine of Negative Number = -3.09
Python Hyperbolic ArcSine of Tuple Item = -4.38
Python Hyperbolic ArcSine of List Item = -4.44
Python Hyperbolic ArcSine of Multiple Numbers = 4.48
Traceback (most recent call last):
File "app.py", line 15, in <module>
print("Python Hyperbolic Arc Sine of String Value = ", math.asinh('AppDividend'))
TypeError: must be real number, not str```

First, we used the asinh() Function directly on both the Positive integer and negative integer.

The following statements find the hyperbolic arcsine of the corresponding values.

Next, we used the asinh() function on Tuple and List items. If you observe the above screenshot, the asinh() function is working correctly on them.