Copyright © tutorialspoint.com

Python Number sin() Function

previous next


Description:

This function returns the sine of x radians.

Syntax:

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.

Parameters:

Here is the detail of parameters:

Return Value:

The sin() function returns a numeric value between -1 and 1, which represents the sine of the parameter x.

Example:

#!/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

previous next

Copyright © tutorialspoint.com