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 the numpy.arcsin() function. This could be ndarray, None, or tuple of the ndarray. 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 array
array = np.array([0, 1, -1])
#Calculating the arcsin of the values
result = np.arcsin(array)
#Using the out parameter
new_result = np.array([0, np.pi/2, np.pi])
np.arcsin(array, out = new_result)
#Printing the results
print("Cosine of values : ", result)
print("New Result array : ", new_result)

Explanation

  • Line 3: We create an array using the np.array method.
  • 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_result array using the out parameter.
  • 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 from x. So, this method returns an angle that lies in the closed interval [-pi/2, pi/2].

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved