Open In App

Python | sympy.tan() method

Last Updated : 01 Feb, 2023
Comments
Improve
Suggest changes
Like Article
Like
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

Article Tags :
Practice Tags :

Similar Reads