Is trigonometry really needed?

Hello, so I was wondering… it’s
sin
cos
tan
atan
acos
asin
atan2
Really needed?

What I mean is, is it needed yes or yes for some stuff, or this can be made with just math?

(with math I mean, like, %, /, *,^)

3 Likes

You don’t need trigonometry nor those functions for a Roblox game. But don’t force a use case for them though. That is just going to unnecessarily complicate your code. Think of trigonometry as a tool. You use it only when you need it. You wouldn’t use a shovel to cut a tree.

6 Likes

Yes. They are. Even middle (and even some low) level languages have an in-built trigonometry library. We aren’t coding in x86. This is Lua, a very high level language.

2 Likes

What I meant was, like, is there something about this trigonometry that we can’t make with just math? like traditional math

See How does C compute sin() and other math functions? - Stack Overflow for how these inbuilt functions work. It’s incredibly complex, and it’s like using toothpicks to build the Empire State Building.

1 Like

it is traditional math, using functions from the standard C library,
such as math.atan which simply returns the arc tangent of x in radians can be used instead of

image

using ‘traditional math’ as you call it, which would take way more steps then

return math.atan(2)

it is used in calculation in various areas,

from another post

1 Like

Yes I know, I was just wondering if it was REALLY needed like to make something, but I think no, like, it makes it more easy or less lines I suppose, but trigonometry is hard, with ‘traditional math’ I meant well, the typical stuff lol, out of trigonometry.

There are plenty of situations you might want to use it for, yes. It isn’t needed for everything, but it does have its use cases. Sine waves can be useful for a lot of cool visual effects, and trig can be used to do lots of useful stuff like find a point on a circle given a radius and an angle. I don’t really know what kind of answer you’re looking for, though. Do you want examples of uses for trig, or just to be told “yeah it’s useful”?

3 Likes

It really depends on what you’re making. A door that opens when you click on it shouldn’t require the use of trigonometry, while something like aligning the camera to fit a part on the screen WOULD require some trig.

1 Like

What I mean is we can just replcate it doing math, like * / % and ^

Not really. You can try to approximate them using standard math, but it’s more trouble than it’s worth.

3 Likes

I guess I will tryhard to understand, but it’s too complicated.

Trigonometry is a fundamental branch of mathematics on its own that cannot truly be replicated with elementary operators, such as multiplication, addition, subtraction, division, exponentiation, or modulus. There is no way to calculate trigonometric ratios without its respective functions.

1 Like

Yes lets use some infinite series that represent sine, cosine, and tangent. Of course we can’t iterate an infinite amount of times, but we could always just iterate a million times for an approximate answer! Using those you could be able to move them around and solve for atan, acos, and asin and any other trigometric functions you want.

Here are some magic formulas I ripped from google images:

image
image
image

In short: You should be using the prebuillt functions if you want to do trigometric operations. They’re easier, faster, and more readable.

Generally if you need to work on angles, yes you need sine and cosine to actualize them in the world.

But yeah if you have two 2d vectors, and you want to add their angles to get a new vector, you actually don’t need to use angles or trig.

If you have a 2d vector and you want to scale its angle by some factor, you’re going to need to use angles and trig.

But even then you don’t need to use math.sin(x), as you can compute sin(x) using basic arithmetic. sin(x) is approximately x - x^3/6 + x^5/120 - x^7/5040

1 Like