Open In App

Python | sympy.tan() method

Last Updated : 01 Feb, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

In sympy, tan() method is a tangent function. Using the tan(x) method in the sympy module, we can compute the tangent or arctangent of x.

Syntax : sympy.tan(x)

Return : Returns the tangent of x 

Code #1: Below is the example using tan() method to find the inverse tangent function. 

Python3




# importing sympy library
from sympy import *
 
# calling tan() method on expression
geek1 = tan(-1)
geek2 = tan(pi / 3)
geek3 = tan(pi / 2) # gives infinity
 
print(geek1)
print(geek2)
print(geek3)


Output: 

-tan(1)
sqrt(3)
zoo 

  Code #2: 

Python3




# importing sympy library
from sympy import tan
 
 
# calling tan() method on expression
geek = tan(2 + 5j)
print(geek)


Output: 

-6.87216388011928e-5 + 1.000059350149*I

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads