Tutorials Point


  Python Basics
  Python Advanced
  Python Useful References
  Python Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Python Number sin() Function


previous next AddThis Social Bookmark Button


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:

  • x: Must be a numeric value

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 Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names