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
.
numpy.arcsin(x, out=None)
x
: This method takes an array of numbers as the input.out** = None
: This is an optional parameter in the numpy.arcsin()
function. This could be ndarray
, None
, or tuple
of the ndarray
. This parameter identifies a location where the solution is stored.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)
np.array
method.array
.new_result
array using the out
parameter.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