Python math.acosh() Method

Python math.acosh() method is “used to calculate the hyperbolic arc cosine of the given number in radians”.

Syntax

math.acosh(var) 

Here, var is the variable of which hyperbolic cosine arc we must find.

Parameters

var: It is a positive number >= 1. If x is not a number, it returns a TypeError.

Return Value

It returns the hyperbolic arc cosine value of the number in the float datatype.

Example 1: How to Use the math.acosh() Method

import math

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

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

Output

Value for parameter 3.5 is 1.9248473002384139
Value for parameter 1 is 0.0
Value for parameter 7 is 2.6339157938496336
Value for parameter 5.3 is 2.351832816454804

Example 2: ValueError: math domain error

import math

q = 0.5
print(math.acosh(q))

Output

ValueError: math domain error 

In this example, we’ve seen that we get a math domain error by passing a parameter that is less than 1.

That’s it.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.