This function is used to calculate the hyperbolic tangent for all the elements of the array passed as the argument.
numpy.tanh(array[,out] )
An array with trigonometric tangent sins are returned.
import numpy as np import math arr = np.array([0, math.pi/4, 3*math.pi/2, math.pi/6]) print("Input Array:",arr) print("tanh Array:",end=" ") tanharr = np.tanh(arr) print(tanharr)
Output: