Skip to content
Related Articles

Related Articles

Python | sympy.cos() method
  • Last Updated : 19 Jul, 2019

In simpy, cos() method is cosine function. Using the cos(x) method in simpy 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.




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

Output:

cos(1)
1/2

 
Code #2:




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

Output:

-30.8822353189167 - 67.4727884405875*I

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :