Numpy tan() method

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

Syntax

snippet
numpy.tan(array[,out] )

Parameters

  1. array: Array elements whose tangent values are to be calculated.
  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("tan Array:",end=" ")
tanarr = np.tan(arr)
print(tanarr)

Output:

Output
Input Array: [0. 0.78539816 4.71238898 0.52359878] tan Array: [0.00000000e+00 1.00000000e+00 5.44374645e+15 5.77350269e-01]
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +