{"id":16376,"date":"2021-08-12T09:33:44","date_gmt":"2021-08-12T04:03:44","guid":{"rendered":"https:\/\/python-programs.com\/?p=16376"},"modified":"2021-11-22T18:38:28","modified_gmt":"2021-11-22T13:08:28","slug":"python-program-to-find-the-sine-series-for-the-given-range","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-the-sine-series-for-the-given-range\/","title":{"rendered":"Python Program to Find the Sine Series for the Given range"},"content":{"rendered":"
In the previous article, we have discussed Python Program to Find Super Factorial of a Number.<\/a> Python’s math module is a built-in module. By importing this module, we can perform mathematical computations.<\/p>\n Numerous mathematical operations like ceil( ),floor( ),factorial( ),mod( ),value of pi ,…..etc .can be computed with the help of math module.<\/p>\n math.sin() function:<\/strong><\/p>\n To compute the sine value, we must use the sine function as math. sine() takes only one parameter, the degree value.<\/p>\n Sin is a trigonometric function that represents the Sine function. Its value can be calculated by dividing the length of the opposite side by the length of the hypotenuse of a right-angled triangle, as we learned in math.<\/p>\n By importing the math module that contains the definition, we will be able to use the sin() function in Python to obtain the sine value for any given angle.<\/p>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example 2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Below are the ways to find the sine values in the Given Range.<\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Explore more instances related to python concepts from\u00a0Python Programming Examples<\/a>\u00a0Guide and get promoted from beginner to professional programmer level in Python Programming Language.<\/p>\n In the previous article, we have discussed Python Program to Find Super Factorial of a Number. Math Module : Python’s math module is a built-in module. By importing this module, we can perform mathematical computations. Numerous mathematical operations like ceil( ),floor( ),factorial( ),mod( ),value of pi ,…..etc .can be computed with the help of math …<\/p>\n
\nMath Module :<\/strong><\/p>\nGiven lower limit range =0\r\nGiven upper limit range =181\r\nGiven step size =30<\/pre>\n
The Sine values in a given range are : \r\nsin 0 = 0.0\r\nsin 30 = 0.49999999999999994\r\nsin 60 = 0.8660254037844386\r\nsin 90 = 1.0\r\nsin 120 = 0.8660254037844387\r\nsin 150 = 0.49999999999999994\r\nsin 180 = 1.2246467991473532e-16<\/pre>\n
Given lower limit range = 50\r\nGiven upper limit range = 200 \r\nGiven step size = 20<\/pre>\n
The Sine values in a given range are : \r\nsin 50 = 0.766044443118978\r\nsin 70 = 0.9396926207859083\r\nsin 90 = 1.0\r\nsin 110 = 0.9396926207859084\r\nsin 130 = 0.766044443118978\r\nsin 150 = 0.49999999999999994\r\nsin 170 = 0.17364817766693028\r\nsin 190 = -0.17364817766693047<\/pre>\n
Program to Find the Sine Series for the Given range<\/h2>\n
\n
Method #1: Using math Module (Static input)<\/h3>\n
\n
# Import math module using the import keyword.\r\nimport math\r\n# Give the lower limit range as static input and store it in a variable.\r\nlwer_lmt = 0\r\n# Give the upper limit range as static input and store it in another variable.\r\nupp_lmt = 181\r\n# Give the step size as static input and store it in another variable.\r\nstp_sze = 30\r\n# Loop from lower limit range to upper limit range using For loop.\r\nprint(\"The Sine values in a given range are : \")\r\nfor vale in range(lwer_lmt, upp_lmt, stp_sze):\r\n # Get the angle value in radians from the given range(converting from degree to radians )\r\n # and store it in a variable.\r\n radns = math.radians(vale)\r\n # Calculate the Sine value in a given range of above obtained radian values using\r\n # math.Sine()function and store it in another variable.\r\n sine_vlue = math.sin(radns)\r\n # print the Sine Values in the above given range.\r\n print(\"sin\",vale, \"=\", sine_vlue)\r\n<\/pre>\n
The Sine values in a given range are : \r\nsin 0 = 0.0\r\nsin 30 = 0.49999999999999994\r\nsin 60 = 0.8660254037844386\r\nsin 90 = 1.0\r\nsin 120 = 0.8660254037844387\r\nsin 150 = 0.49999999999999994\r\nsin 180 = 1.2246467991473532e-16<\/pre>\n
Method #2: Using math Module (User input)<\/h3>\n
\n
# Import math module using the import keyword.\r\nimport math\r\n# Give the lower limit range as User input using the int(input()) function and store it in a variable.\r\nlwer_lmt = int(input('Enter some Random number ='))\r\n# Give the upper limit range as User input using\u00a0the\u00a0int(input())\u00a0function and store it in another variable.\r\nupp_lmt = int(input('Enter some Random number ='))\r\n# Give the step size as User input and store it in another variable.\r\nstp_sze = int(input('Enter some Random number ='))\r\n# Loop from lower limit range to upper limit range using For loop.\r\nprint(\"The Sine values in a given range are : \")\r\nfor vale in range(lwer_lmt, upp_lmt, stp_sze):\r\n # Get the angle value in radians from the given range(converting from degree to radians )\r\n # and store it in a variable.\r\n radns = math.radians(vale)\r\n # Calculate the Sine value in a given range for the above obtained radian values using\r\n # math.sin()function and store it in another variable.\r\n sine_vlue = math.sin(radns)\r\n # print the Sine Values in the above given range.\r\n print(\"sin\",vale, \"=\", sine_vlue)<\/pre>\n
Enter some Random number = 50\r\nEnter some Random number = 200\r\nEnter some Random number = 20\r\nThe Sine values in a given range are : \r\nsin 50 = 0.766044443118978\r\nsin 70 = 0.9396926207859083\r\nsin 90 = 1.0\r\nsin 110 = 0.9396926207859084\r\nsin 130 = 0.766044443118978\r\nsin 150 = 0.49999999999999994\r\nsin 170 = 0.17364817766693028\r\nsin 190 = -0.17364817766693047<\/pre>\n
\n