Friday, December 27, 2024
Google search engine
HomeLanguagesPython | sympy.sin() method

Python | sympy.sin() method

In sympy, the sin() method is a sine function. Using the sin(x) method in the sympy module, we can compute the sine of x.

Syntax : sympy.sin(x)
Return : Returns the sine of x 

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

Python3




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


Output: 

-sin(1)
sqrt(3)/2
0

  Code #2: 

Python3




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


Output: 

67.4789152384559 - 30.8794313435882*I
RELATED ARTICLES

Most Popular

Recent Comments