# What is math.pi used for?

2 replies__1__

22.03.20 07:54:43 pm

Hello guys again,

I came up with a math question, I would like to know everything about

I came up with a math question, I would like to know everything about

math.pi

and how to use it in lua? Probably could some of you give me some examples of using it, please? As far as i know it has a fair connection with math.rad

, math.sin

, math.cos

and math.tan

. edited 1×, last 22.03.20 08:04:46 pm

math.pi is basically a constant value. The value of pi (3.14159...)

https://en.wikipedia.org/wiki/Pi

It's required for all sorts of trigonometric calculations. Including sin/cos/tan which require an angle in radians in Lua. pi is equal to an angle of 180°. pi/2 is equal to 90° etc.

math.rad converts an angle in degrees to an angle in radians.

math.deg converts an angle in radians to an angle in degrees.

e.g.

is equal to

Also see http://lua-users.org/wiki/MathLibraryTutorial

Additional mathematical background information

https://math.libretexts.org/Bookshelves/Precalculus/Map%3A_Elementary_Trigonometry_(Corral)/04%3A_Radian_Measure/4.01%3A_Radians_and_Degrees

https://en.wikipedia.org/wiki/Pi

It's required for all sorts of trigonometric calculations. Including sin/cos/tan which require an angle in radians in Lua. pi is equal to an angle of 180°. pi/2 is equal to 90° etc.

math.rad converts an angle in degrees to an angle in radians.

math.deg converts an angle in radians to an angle in degrees.

e.g.

math.sin(math.pi)

is equal to

math.sin(math.rad(180))

Also see http://lua-users.org/wiki/MathLibraryTutorial

Additional mathematical background information

https://math.libretexts.org/Bookshelves/Precalculus/Map%3A_Elementary_Trigonometry_(Corral)/04%3A_Radian_Measure/4.01%3A_Radians_and_Degrees

__1__