Copyright © tutorialspoint.com
This function returns the sine of x radians.
sin(x) |
Note: This function is not accessible directly so we need to import math module and then we need to call this function using math static object.
Here is the detail of parameters:
x: Must be a numeric value
The sin() function returns a numeric value between -1 and 1, which represents the sine of the parameter x.
#!/usr/bin/python import math print "sin(3) : ", math.sin(3) print "sin(-3) : ", math.sin(-3) print "sin(0) : ", math.sin(0) print "sin(math.pi) : ", math.sin(math.pi) print "sin(math.pi/2) : ", math.sin(math.pi/2) |
This will produce following result:
sin(3) : 0.14112000806 sin(-3) : -0.14112000806 sin(0) : 0.0 sin(math.pi) : 1.22460635382e-16 sin(math.pi/2) : 1 |
Copyright © tutorialspoint.com