How to use math.cos()

Hi
I’m using math.cos() in my script, but I don’t really understand how to use it. It says x is assumed to be in radians? I want to use it with degrees. For example if I want to fine cos of 35 degrees then it should return 0.819… like every calculator does, but it returns something else.

1 Like

I don’t see a reason using cos for measuring degrees, are you trying to make a circle?

Plus, it’s for radians not degrees, so it’s different

I’m trying to find side A based on an angle and H, Then I use cos35 = A/H so I want to get cos35 to work.

You can use math.rad() to convert degrees to radians or similarly math.deg() to convert degrees to radians.

  13:12:01.229  > print( math.cos( math.rad(35) ) )  -  Studio
  13:12:01.229  0.8191520442889918  -  Edit
4 Likes

Thank you! That’s what I was looking for.

1 Like

You should probably check out Roblox’s article on Lua’s math library.

I know what math.rad() is but what is math.cos()? I have no idea what cos means

What Are Sine, Cosine, and Tangent? — I hope this helps you on understanding what cos and sin/tan are and how to use them.

1 Like

Thanks I never learned about Trigonometry my whole life.