لَآ إِلَـٰهَ إِلَّا هُوَ
LA ILAHA ILLA HU
Allah, Your Lord There Is No Deity Except Him.

# Python Data Science NumPy ufunc NumPy's Hyperbolic Functions

What are Hyperbolic Functions?

NumPy provides the ufuncs sinh(), cosh() and tanh() that take values in radians and produce the corresponding sinh, cosh and tanh values.

Example 1: Find sinh value of PI/3.

Code

import numpy as np

x = np.sinh(np.pi/3)

print(x)

the output will be

1.2493670505239751

Example 2: Find cosh values for all of the values in arr.

Code

import numpy as np

arr = np.array([np.pi/2, np.pi/3, np.pi/4])

x = np.cosh(arr)

print(x)

the output will be

[2.50917848 1.60028686 1.32460909]

Finding Angles

Finding angles from values of hyperbolic sine, cos, tan.
E.g. Inverse of sinh, cosh and tanh are arcsinh, arccosh, and arctanh respectively.

Numpy provides ufuncs arcsinh(), arccosh() and arctanh() that produce radian values for corresponding sinh, cosh and tanh values.

Example 3: Find the angle of 2.0.

Code

import numpy as np

x = np.arcsinh(2.0)

print(x)

the output will be

1.4436354751788103

Angles of Each Value in Arrays

Example 4: Find the angle for all of the tanh values in array.

Code

import numpy as np

arr = np.array([0.5, 0.1, 0.2, 0.3])

x = np.arctanh(arr)

print(x)

the output will be

[0.54930614 0.10033535 0.20273255 0.3095196 ]
Note: NumPy ufunc Universal function or ufuncs is a function which operates on ndarrays in an element by element fashion and supports array broadcasting, type casting, and many other standard features.