Curriculum
Course: NumPy
Login

Curriculum

NumPy

Text lesson

ufunc Hyperbolic

Hyperbolic Functions

NumPy offers the ufuncs sinh(), cosh(), and tanh() that accept values in radians and return the corresponding hyperbolic sine, cosine, and tangent values.

Example

Calculate the sinh value of π/2.

import numpy as np

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

print(x)

Example

Calculate the cosh values for all elements in the array arr.

import numpy as np

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

x = np.cosh(arr)

print(x)

Finding Angles

Finding angles from hyperbolic sine, cosine, and tangent values involves using inverse functions like arcsinh, arccosh, and arctanh. NumPy provides the ufuncs arcsinh(), arccosh(), and arctanh() to return angle values in radians for the corresponding sinh, cosh, and tanh values.

Example

Determine the angle corresponding to a value of 1.0.

import numpy as np

x = np.arcsinh(1.0)

print(x)

Angles of Each Value in Arrays

Example

Calculate the angle for all tanh values in the array.

import numpy as np

arr = np.array([0.10.20.5])

x = np.arctanh(arr)

print(x)