Python math.acosh() Method



The Python math.acosh() method is used to find the inverse hyperbolic cosine of a given number.

The inverse hyperbolic cosine method is denoted as cosh-1(x) or sometimes as arccosh(x), is a mathematical method that gives the value whose hyperbolic cosine is a given number x. In simple terms, if you have a value x greater than or equal to 1, the acosh() method will return the value (generally in real numbers) whose hyperbolic cosine equals x.

Mathematically, it can be expressed as −

cosh-1(x) = value y such that cosh(y) = x

The domain of the inverse hyperbolic cosine method is restricted to the interval [1, ∞), because the range of hyperbolic cosine method range is [1, ∞)

Syntax

Following is the basic syntax of the Python math.acosh() method −

math.acosh(x)

Parameters

This method accepts a number greater than or equal to 1 for which you want to find the inverse hyperbolic cosine as a parameter.

Return Value

The method returns the inverse hyperbolic cosine of the given number in the range of [0, ∞).

Example 1

In hyperbolic trigonometry, the hyperbolic cosine of 0 is equal to 1. Therefore, when we pass "1" as an argument to the math.acosh() method, it returns 0.0 as the output, indicating that the inverse hyperbolic cosine of 1 is 0 −

import math
result = math.acosh(1)
print(result)

Output

The output obtained is as follows −

0.0

Example 2

If we pass a fraction value to the math.acosh() method, it returns a positive real number −

import math
from fractions import Fraction
x = Fraction(5, 4)
result = math.acosh(x)
print(result)  

Output

Following is the output of the above code −

0.6931471805599453

Example 3

In the following example, we are passing a larger value "1000" to the math.acosh() method −

import math
x = 1000
result = math.acosh(x)
print(result) 

Output

The result produced is as shown below −

7.600902209541989

Example 4

When we pass a negative number to the math.acosh() method, it results in a domain error because the inverse hyperbolic cosine method is defined only for numbers greater than or equal to 1 −

import math
x = -2.0
result = math.acosh(x)
print(result)  

Output

We get the output as shown below −

Traceback (most recent call last):
  File "/home/cg/root/65fbd333dfa67/main.py", line 3, in <module>
result = math.acosh(x)
ValueError: math domain error
python_maths.htm
Advertisements