What is numpy.arcsin() in Python?
In mathematics, we use some functions to get the inverse of a trigonometric function. The numpy.arcsin() function in Python returns the inverse of numpy.sin() of a number. To be more precise, it returns the inverse of a sin.
Syntax
numpy.arcsin(x, out=None)
Input parameters
x: This method takes an array of numbers as the input.- **
out** = None: This is an optional parameter in thenumpy.arcsin()function. This could bendarray,None, ortupleof thendarray. This parameter identifies a location where the solution is stored.
Returns
This method returns an ndarray containing the inverse sin values of numbers from the input. The output may be scalar if the input is scalar. The output is always a radian in a closed interval of [-pi/2, pi/2].
import numpy as np# Creating an arrayarray = np.array([0, 1, -1])#Calculating the arcsin of the valuesresult = np.arcsin(array)#Using the out parameternew_result = np.array([0, np.pi/2, np.pi])np.arcsin(array, out = new_result)#Printing the resultsprint("Cosine of values : ", result)print("New Result array : ", new_result)
Explanation
- Line 3: We create an array using the
np.arraymethod. - Line 6: We calculate the inverse sin of the values in the
array. - Line 9: We create a new array.
- Line 10: We calculate the inverse sin values and store them in the
new_resultarray using theoutparameter. - Line 13 and 14: We print the resultant arrays.
Note:
arcsin()is a multi-valued function. This means there may be a lot of values against one input value fromx. So, this method returns an angle that lies in the closed interval[-pi/2, pi/2].
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved