NumPy Tutorial NumPy Statistics NumPy References

NumPy - arcsin() function



The NumPy arcsin() function is used to calculate arc sine (inverse sine) of given value. The returned value will be in the range -𝜋/2 through 𝜋/2.

Syntax

numpy.arcsin(x, out=None)

Parameters

x Required. Specify array (array_like) containing elements in range [-1, 1], of which the arc sine is calculated.
out Optional. Specify a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.

Return Value

Returns the inverse sine of each element in x.

Example:

In the example below, numpy arcsin() function is used to calculate the inverse sine of each element present in array sinArr.

import numpy as np

Arr = np.array([0, 30, 60, 90])
#converting the angles in radians
Arr = Arr*np.pi/180

sinArr = np.sin(Arr)
inv_sinArr = np.arcsin(sinArr)
print("The sin value of angles:")
print(sinArr)
print("The inverse of the sin value (in radians):")
print(inv_sinArr)
print("The inverse of the sin value (in degrees):")
print(np.degrees(inv_sinArr))

The output of the above code will be:

The sin value of angles:
[ 0.         0.5        0.8660254  1.       ]
The inverse of the sin value (in radians):
[ 0.          0.52359878  1.04719755  1.57079633]
The inverse of the sin value (in degrees):
[  0.  30.  60.  90.]

❮ NumPy - Functions