Open In App

Python | sympy.cos() method

Last Updated : 30 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

In sympy, cos() method is cosine function. Using the cos(x) method in the sympy module, we can compute the cosine of x.

Syntax : sympy.cos(x)

Return : Returns the cosine of x 

Code #1: Below is the example using cos() method to find cosine function. 

Python3




# importing sympy library
from sympy import *
 
# calling cos() method on expression
geek1 = cos(-1)
geek2 = cos(pi / 3)
geek3 = cos(pi)
 
print(geek1)
print(geek2)
print(geek3)


Output: 

cos(1)
1/2
-1

  Code #2: 

Python3




# importing sympy library
from sympy import *
 
 
# calling cos() method on expression
geek = cos(2 + 5j)
print(geek)


Output: 

-30.8822353189167 - 67.4727884405875*I

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads