tan function - python math module

tan function in the math module of python, provides tan theta value for an angular value, which is the ratio of cos theta and sine theta

Math Updated 26 Sep 2016 1 min read

Method name

tan(aRadians_in)

Method overview

The python, math.tan() function returns the ratio of the cosine theta
value to the sine theta value, for the given radian value.

Parameters

aRadians_in : Radians for which the tangent θ value needs to be found.

Return value

The tangent θ value for the given radian value is returned.

Example

python
# Find tan θ value for common angles

import math

# tan θ value for zero degrees

Radians0    = math.radians(0)

tan0        = math.tan(Radians0)

tan0Rounded = round(tan0,2)

# tan 30 value for zero degrees

Radians30           = math.radians(30)

tan30               = math.tan(Radians30)

tan30Rounded        = round(tan30,2)

# tan 45 value for zero degrees

Radians45       = math.radians(45)

tan45           = math.tan(Radians45)

tan45Rounded    = round(tan45,2)

# tan 60 value for zero degrees

Radians60           = math.radians(60)

tan60               = math.tan(Radians60)

tan60Rounded        = round(tan60,2)

# tan 90 value for zero degrees

Radians90       = math.radians(90)

tan90           = math.tan(Radians90)

tan90Rounded    = round(tan90,2)

# math.tan(radians) : Python Example: Printing tangent θ values for common angles

print("tan 0:{}".format(tan0Rounded))

print("tan 30:{}".format(tan30Rounded))

print("tan 45:{}".format(tan45Rounded))

print("tan 60:{}".format(tan60Rounded))

print("tan 90:{}".format(tan90Rounded))

Output

Output
tan 0:0.0

tan 30:0.58

tan 45:1.0

tan 60:1.73

tan 90:1.633123935319537e+16