tan() math function in python by R4R Team

- tan() is python math function which determine the tangent value of number.

Syntax-

math.tan(x)

- Here x should be a numeric value.
- it return the tangent value of x in radians.

Example-

tan(0) will return 0.0
tan(45) will 1.6197751905438615

program-

import math

#these value are in radians
print("tan(90) : ",math.tan(90))
print("tan(0) : ",math.tan(0))
print("tan(45) : ",math.tan(45))
print("tan(60) : ",math.tan(60))
print("tan(10) : ",math.tan(10))


output-

tan(90) : -1.995200412208242
tan(0) : 0.0
tan(45) : 1.6197751905438615
tan(60) : 0.320040389379563
tan(10) : 0.6483608274590866


-If we want to print the cosine value of x, consider x should be in degree then

program-

import math
#these value are in degree
n=math.pi/180
print("tan(90) : ",math.tan(90*n))
print("tan(0) : ",math.tan(0*n))
print("tan(45) : ",math.tan(45*n))
print("tan(60) : ",math.tan(60*n))
print("tan(10) : ",math.tan(10*n))


output-

tan(90) : 1.633123935319537e+16
tan(0) : 0.0
tan(45) : 0.9999999999999999
tan(60) : 1.7320508075688767
tan(10) : 0.17632698070846498




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!