Open In App

Python | sympy.atan2() method

In sympy, atan2() method is an inverse tangent function. Using the atan2(x, y) method in sympy module, we can compute the two-argument arctangent. This function is defined for real x and y only.
 

Syntax : sympy.atan(x)

Return : Returns the arc tangent of x 

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






# importing sympy library
from sympy import *
  
# calling atan2() method on expression
geek1 = atan2(1, 1)
geek2 = atan2(1, -1)
geek3 = atan(zoo) # infinity condition
  
print(geek1)
print(geek2)
print(geek3)

Output: 

pi/4
3*pi/4
AccumBounds(-pi/2, pi/2)

  
Code #2: 






# importing sympy library
from sympy import atan2
 
 
# calling atan2() method on expression
geek = atan2(-1, -1)
print(geek)

Output: 

-3*pi/4

 

Article Tags :