{"id":24301,"date":"2021-10-14T09:18:18","date_gmt":"2021-10-14T03:48:18","guid":{"rendered":"https:\/\/python-programs.com\/?p=24301"},"modified":"2021-11-05T21:05:21","modified_gmt":"2021-11-05T15:35:21","slug":"python-program-for-asin-function","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-asin-function\/","title":{"rendered":"Python Program for asin() Function"},"content":{"rendered":"
In the previous article, we have discussed Python Program for acos() Function<\/a> The arc sine of a number is returned by the math.asin() method.<\/p>\n Note:<\/strong> It should be noted that the parameter passed in math.asin() must be between -1 and 1.<\/p>\n Tip:<\/strong> math.asin(1) returns the value PI\/2, while math.asin(-1) returns the value -PI\/2. (where PI= 22\/7)<\/p>\n Syntax:<\/strong><\/p>\n Parameters:<\/strong><\/p>\n x:<\/strong> This is required. It is a number between -1 and 1. If x is not a number, a TypeError is returned.<\/p>\n Return Value:<\/strong><\/p>\n Returns a float value which represents a number’s arc sine.<\/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 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 Know all about Mathematical Functions in Python by going through our Python Mathematical Methods Examples<\/a> well explained step by step.<\/p>\n In the previous article, we have discussed Python Program for acos() Function asin() Function in Python: The arc sine of a number is returned by the math.asin() method. Note: It should be noted that the parameter passed in math.asin() must be between -1 and 1. Tip: math.asin(1) returns the value PI\/2, while math.asin(-1) returns the …<\/p>\n
\nasin() Function in Python:<\/strong><\/p>\nmath.asin(x)<\/pre>\n
\n
Given first number = 0.5\r\nGiven second number = 1<\/pre>\n
The result after applying asin() function on above given first number 0.5 = 0.5235987755982989\r\nThe result after applying asin() function on above given second number 1 = 1.5707963267948966<\/pre>\n
Given first number = -1\r\nGiven second number = 0.6<\/pre>\n
The result after applying asin() function on above given first number -1 = -1.5707963267948966\r\nThe result after applying asin() function on above given second number 0.6 = 0.6435011087932844<\/pre>\n
Program for asin() Function in Python<\/h2>\n
\n
Method #1: Using Built-in Functions (Static Input)<\/h3>\n
\n
# Import math module using the import keyword.\r\nimport math\r\n# Give the list as static input and store it in a variable.\r\ngvn_lst = [0.92, 0.1, -0.4, 0.75]\r\n# Give the first number as static input and store it in another variable.\r\ngvn_numb1 = 0.5\r\n# Apply math.asin() function to the given first number to get arc sine value\r\n# (inverse of sine) of a given number.\r\n# Store it in another variable.\r\nfnl_rslt = math.asin(gvn_numb1)\r\nprint(\"The result after applying asin() function on above given first number\",\r\n gvn_numb1, \" = \", fnl_rslt)\r\n# similarly do the same for the other number.\r\ngvn_numb2 = 1\r\nprint(\"The result after applying asin() function on above given second number\",\r\n gvn_numb2, \" = \", math.asin(gvn_numb2))\r\n# Apply math.asin() function to the given list element and print it.\r\nprint(\r\n \"The result after applying asin() function on given list element gvnlst[1] = \", math.asin(gvn_lst[1]))\r\n<\/pre>\n
The result after applying asin() function on above given first number 0.5 = 0.5235987755982989\r\nThe result after applying asin() function on above given second number 1 = 1.5707963267948966\r\nThe result after applying asin() function on given list element gvnlst[1] = 0.1001674211615598<\/pre>\n
Method #2: Using Built-in Functions (User Input)<\/h3>\n
\n
# Import math module using the import keyword.\r\nimport math\r\n# Give the list as user input using list(),map(),input(),and split() functions.\r\n# Store it in a variable.\r\ngvn_lst = list(map(float, input(\r\n 'Enter some random List Elements separated by spaces = ').split()))\r\n# Give the first number as user input using the float(input()) function\r\n# and store it in a variable.\r\ngvn_numb1 = float(input(\"Enter some random number = \"))\r\n# Apply math.asin() function to the given first number to get arc sine value\r\n# (inverse of sine) of a given number.\r\n# Store it in another variable.\r\nfnl_rslt = math.asin(gvn_numb1)\r\nprint(\"The result after applying asin() function on above given first number\",\r\n gvn_numb1, \" = \", fnl_rslt)\r\n# similarly do the same for the other number.\r\ngvn_numb2 = float(input(\"Enter some random number = \"))\r\nprint(\"The result after applying asin() function on above given second number\",\r\n gvn_numb2, \" = \", math.asin(gvn_numb2))\r\n# Apply math.asin() function to the given list element and print it.\r\nprint(\r\n \"The result after applying asin() function on given list element gvnlst[2] = \", math.asin(gvn_lst[2]))\r\n<\/pre>\n
Enter some random List Elements separated by spaces = 0 3 -0.5 3 -1\r\nEnter some random number = -1\r\nThe result after applying asin() function on above given first number -1.0 = -1.5707963267948966\r\nEnter some random number = 0.6\r\nThe result after applying asin() function on above given second number 0.6 = 0.6435011087932844\r\nThe result after applying asin() function on given list element gvnlst[2] = -0.5235987755982989<\/pre>\n
\n