Python asin: How to Use Math.asin() Function

Python asin() is an inbuilt method that is defined under the math module, which is used to find the arcsine of var (var is a variable which ranges from -1 to 1) in radians. We can use a math module by importing it. After importing it, we can use to call this function using the static object.

Python asin() function

Python number method asin() returns the arc sine of x in radians. Python asin() function is one of the Python Math module, which calculates the trigonometry Arc Sine for the specified expression. Python asin or Arc Sine also called the inverse of a Sine.




It takes one parameter var, which takes values from the range -1 to 1 and throws and value error if we exceed or precede the given range.

Return Value

It returns the arcsine value of the number in the float datatype.

If the num argument is a positive or negative number, the asin function returns the Arc Sine value.

If it is not a num, the asin function returns TypeError. If it is outside the range of -1 and 1, the asin() function returns ValueError.

See the following example.

var = 0.36

Example programs on asin() method in Python

Write a program to show the working of the asin() method in Python.


import math

a1 = 0.36
b1 = 1
c1 = -1
d1 = -0.36

print("Value for parameter ", a1, " is ", math.asin(a1))
print("Value for parameter ", b1, " is ", math.asin(b1))
print("Value for parameter ", c1, " is ", math.asin(c1))
print("Value for parameter ", d1, " is ", math.asin(d1))


Value for parameter  0.36  is  0.36826789343663996
Value for parameter  1  is  1.5707963267948966
Value for parameter  -1  is  -1.5707963267948966
Value for parameter  -0.36  is  -0.36826789343663996

In this example, we have seen that by passing a valid parameter which is different for different examples, we get the desired asin() method solution.

Example 2: Write a program to pass a value out of range from the asin() function and display the output.

See the following code.


import math
a1 = 2

print("Value for parameter ", a1, " is ", math.asin(a1))


ValueError: math domain error

In this example, we have seen that passing a parameter with value 2 gives us a math domain error as the function only accepts a value from -1 to 1.


Python math.asin() function exists in the Standard math Library of Python Programming Language. The purpose of this function is to calculate arcsine or the inverse of the sine of any given number within the range of -1 and 1.

See also

Python log(2)

Python log(x, base)

Python log1p(x)

Python exp()

Python acos()

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.