{"id":22911,"date":"2021-09-29T20:14:26","date_gmt":"2021-09-29T14:44:26","guid":{"rendered":"https:\/\/python-programs.com\/?p=22911"},"modified":"2021-11-22T18:35:35","modified_gmt":"2021-11-22T13:05:35","slug":"python-program-for-arc-length-from-given-angle","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-arc-length-from-given-angle\/","title":{"rendered":"Python Program for Arc Length from Given Angle"},"content":{"rendered":"
In the previous article, we have discussed Python Program to Find Area of a Circular Segment<\/a> An angle is a geometrical figure formed when two rays intersect at the same point on a plane. These rays form the angle’s sides, and the point where they intersect is known as the angle’s vertex. It is important to remember that the plane that forms an angle does not have to be a Euclidean plane. The length of an arc in a circle is now a fraction of the circumference.<\/p>\n Formula:<\/strong><\/p>\n ArcLength = ( 2 * pi * radius ) * ( angle \/ 360 )<\/p>\n diameter = 2* radius<\/p>\n The angle is given in degrees.<\/p><\/blockquote>\n Note:<\/strong> It should be noted that if the angle is greater than or equal to 360 degrees, the arc length cannot be calculated because no angle is possible.<\/p>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Below are the ways to calculate the arc length from the given angle in python:<\/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 Practice Python Program Examples<\/a> to master coding skills and learn the fundamental concepts in the dynamic programming language Python.<\/p>\n In the previous article, we have discussed Python Program to Find Area of a Circular Segment Given the diameter and angle of the circle, the task is to calculate the arclength from the given angle. An angle is a geometrical figure formed when two rays intersect at the same point on a plane. These rays …<\/p>\n
\nGiven the diameter and angle of the circle, the task is to calculate the arclength from the given angle.<\/p>\nGiven diameter = 15\r\nGiven Angle = 60<\/pre>\n
The arc length for the given angle { 60 } degrees = 7.857142857142856<\/pre>\n
Given diameter = 30\r\nGiven Angle = 90<\/pre>\n
The arc length for the given angle { 90 } degrees = 23.57142857142857<\/pre>\n
Program for Arc Length from Given Angle in Python<\/h2>\n
\n
Method #1: Using Mathematical Formula (Static Input)<\/h3>\n
\n
# Import math module using the import keyword.\r\nimport math\r\n# Give the diameter as static input and store it in a variable.\r\ngvn_diametr = 15\r\n# Give the angle as static input and store it in another variable.\r\ngvn_angl = 60\r\n# Check if the given angle is greater than or equal to 360 degrees or not using the\r\n# if conditional statement.\r\nif gvn_angl >= 360:\r\n # If it is true, then print \"The Arc length cannot be calculated for\r\n # the given angle\".\r\n print(\"The Arc length cannot be calculated for the given angle.\")\r\nelse:\r\n # Else, calculate the arc length using the above given mathematical formula and\r\n # store it in a variable.\r\n arc_lengt = (3.142857142857143 * gvn_diametr) * (gvn_angl \/ 360.0)\r\n # Print the arclength of the circle from the given angle.\r\n print(\"The arc length for the given angle {\",\r\n gvn_angl, \"} degrees = \", arc_lengt)\r\n<\/pre>\n
The arc length for the given angle { 60 } degrees = 7.857142857142856<\/pre>\n
Method #2: Using Mathematical Formula (User Input)<\/h3>\n
\n
# Import math module using the import keyword.\r\nimport math\r\n# Give the diameter as user input using the float(input()) function and \r\n# store it in a variable.\r\ngvn_diametr = float(input(\"Enter some Random Number = \"))\r\n# Give the angle as user input using the float(input()) function and store it in another variable.\r\ngvn_angl = float(input(\"Enter some Random Number = \"))\r\n# Check if the given angle is greater than or equal to 360 degrees or not using the\r\n# if conditional statement.\r\nif gvn_angl >= 360:\r\n # If it is true, then print \"The Arc length cannot be calculated for\r\n # the given angle\".\r\n print(\"The Arc length cannot be calculated for the given angle.\")\r\nelse:\r\n # Else, calculate the arc length using the above given mathematical formula and\r\n # store it in a variable.\r\n arc_lengt = (3.142857142857143 * gvn_diametr) * (gvn_angl \/ 360.0)\r\n # Print the arclength of the circle from the given angle.\r\n print(\"The arc length for the given angle {\",\r\n gvn_angl, \"} degrees = \", arc_lengt)\r\n<\/pre>\n
Enter some Random Number = 30\r\nEnter some Random Number = 90\r\nThe arc length for the given angle { 90.0 } degrees = 23.57142857142857<\/pre>\n
\n