Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Can you use imaginary and complex numbers in Roblox Studio?

Asked by 3 years ago

I need to use complex numbers for a script but I can't find anything on how to use them in Roblox.

0
Unfortunately, ROBLOX does not have a native subclass that can manage Complex datatypes. You'd have to design your own via OOP that yield  "real" & "imaginary" containers; remember to follow the general rule of i2 = -1  Ziffixture 6913 — 3y

2 answers

Log in to vote
1
Answered by 3 years ago

Roblox does not have native support for complex numbers as far as I know. There's most likely some other person on roblox who has already made a module that does allow you to use complex numbers, but if you can't find anybody who has done that, I recommend making a module for complex numbers yourself. It should be as easy as having the first key be the real part, and having the second key be the imaginary part. Then add a metatable to deal with addition, subtraction, and all that stuff, and you should be good to go.

Ad
Log in to vote
0
Answered by 3 years ago

I don't exactly know what you mean by complex numbers but I assume otherwise. If so, I suggest you use a function called math

Math can be used for angles/irrational numbers, other calculations etc.

i.e This script finds the square root of 64

local number = 64
local calculation = math.sqrt(number) -- 8

print(calculation) -- Prints 8

Likewise, there are many subsidaries to math including math.piand math.atan

There is more tutorials to math here

Answer this question