sympy.cot() method In Python
Last Updated :
18 May, 2023
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:
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
from sympy import *
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
from sympy import *
gfg = simplify(cot(pi / 4 ))
print (gfg)
|
Output :
1
Share your thoughts in the comments
Please Login to comment...