Tuesday, September 24, 2024
Google search engine
HomeLanguagessympy.cot() method In Python

sympy.cot() method In Python

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
Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments