Numpy tanh()

This function is used to calculate the hyperbolic tangent for all the elements of the array passed as the argument.

Syntax

snippet
numpy.tanh(array[,out] )

Parameters

  1. array: Array elements whose tangent values are to be calculated (in radians).
  2. out: shape of the output array.

Return

An array with trigonometric tangent sins are returned.

Example

snippet
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:

Output
Input Array: [0. 0.78539816 4.71238898 0.52359878] tanh Array: [0. 0.6557942 0.99983861 0.48047278]
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents