Open In App

sympy.cot() method In Python

Last Updated : 18 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The cotangent of an angle is defined as the length of the adjacent sides of an angle divided by the length of the opposite side of the angle. The Sympy cot() function in Python is a trigonometric function that is used to find the value of cot theta. In this article, we will see how the cot() function of the Python SymPy module is used to calculate the cotangent of the angle in radians.

Syntax of Python sympy.cot()

The syntax of the Sympy cot() function in Python is as follows:

Syntax : sympy.cot(x) 

Parameter:

  • x: angle in radians

Return : 

Returns the value of cot theta.

Example 1: 

In this example, we will first import the Sympy module and then by using sympy.cot() method, we will find the value of cot theta. The Sympy simplify() function is used to simplify the mathematical expression that is returned by the cot() function.

Python3




# import sympy
from sympy import *
 
# Use sympy.cot() method
gfg = simplify(cot(pi / 3))
   
print(gfg)


Output :

sqrt(3)/3

Example 2: 

This example is similar to the previous one. In this, we are passing the ‘pi/4’ value as the parameter to the cot() function of the Sympy module.

Python3




# import sympy
from sympy import *
 
# Use sympy.cot() method
gfg = simplify(cot(pi / 4))
   
print(gfg)


Output :

1

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads