asin()
Published Nov 3, 2023
Contribute to Docs
Lua’s math.asin()
function calculates the inverse sine, also known as arcsine, of a given value. In other words, it finds the angle in radians whose sine equals the given value. The function takes a number within the range of -1
to 1
as input, representing a sine value, and returns the corresponding angle in radians. This is particularly useful in various applications, such as physics simulations and game development, where understanding angles and trajectories is essential for tasks like character movement and object positioning.
Syntax
The math.asin()
function must be called with an argument using the following syntax:
math.asin(x)
- Where
x
is a number between-1
and1
, representing a sine value for finding the corresponding angle in radians. If no argument is passed, the program will raise an error.
Example 1
The following example shows the usage of math.asin()
:
print(math.asin(1))
Output:
1.5707963267949
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Lua on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Free course
Learn Lua
Learn the basics of Lua, a general-purpose programming language used for building games, web apps, and developer tools.Beginner Friendly4 hours