Python math.asin() - Arc / Inverse Sine
Python math.asin()
math.asin() function returns the inverse sine of given number.
The return value is angle in radians.
Syntax
The syntax to call asin() function is
math.asin(x)
where
Parameter | Required | Description |
---|---|---|
x | Yes | A number in the range [-1, 1]. |
Note: If x is outside the allowed range, then asin(x) raises a ValueError.
Examples
In the following example, we find the inverse sine of 0.5 using asin() function of math module.
Python Program
import math
x = 0.5
result = math.asin(x)
print('asin(x) :', result, 'radians')
Output
asin(x) : 0.5235987755982988 radians
We can convert the returned radians into degrees using math.degrees() function.
In the following example, we find the inverse sine of 0.5 using asin() function and convert this returned radians to degrees.
Python Program
import math
x = 0.5
result = math.asin(x)
result = math.degrees(result)
print('asin(x) :', result, 'degrees')
Output
asin(x) : 29.999999999999996 degrees
Summary
In this Python Examples tutorial, we learned the syntax of, and examples for math.asin() function.