Useful MathModule [v2]
~ How to set up
- Download the module
- Put it anywhere (I recommend putting it in ReplicatedStorage)
- Require it in a script (name it ‘math’)
local math = require(game.ReplicatedStorage.MathModule)
- your done!
~ Values
NOTE: This module was created with the existing math functions so consider naming the variable ‘math’ (it will have the built in and the module functions too)
Tau
-
name:
tau
-
functionality: returns pi * 2
-
output:
Math.tau --> 6.283185307179586
Null
-
name:
null
-
functionality: returns -math.huge
-
output:
Math.null --> -inf
Eulers number
-
name:
euler
-
functionality: returns e (Eulers number)
-
output:
Math.euler --> 2.718281828459045
Golden Ratio
-
name:
phi
-
functionality: returns φ
-
output:
Math.phi --> 1.618033988749895
Nan
-
name:
nan
-
functionality: returns 0/0 (Not A Number)
-
output:
Math.nan --> nan
Limit
-
name:
limit
-
functionality: returns the biggest number that is not = inf
-
output:
Math.limit --> 1.7976931348621742e+308
~ Functions
Circumference
-
name:
circum
-
Arguments:
r (number)
~ r → Radius used to calculate the Circumference -
functionality: returns r * tau
-
Example:
Math.circum(3) --> 18.84955592153876
Cube root
-
name:
cbrt
-
Arguments:
x (number)
~ x → Number that’s cube root will be calculated -
functionality: returns ∛ x
-
Example:
Math.cbrt(64) --> 4
Any Root
-
name:
root
-
Arguments:
x (number), root (number)
~ x → Number that’s root will be calculated
~ root → The Root Number -
functionality: returns ʳᵒᵒᵗ√x
-
Example:
Math.root(16,4) --> 2
Factorial
-
name:
fac
-
Arguments:
x (number)
~ x → Number thats factorial is gonna be calculated -
functionality: returns x!
-
Example:
Math.fac(5) --> 120
Average
-
name:
avg
-
Arguments:
... (numbers)
~ … → Numbers that are gonna be used to calculate the average -
functionality: returns the average of …
-
Example:
Math.avg(1,2,3,4,5) --> 3
Summation
-
name:
sum
-
Arguments:
min (number), max (number)
~ min → Starting number of a line of numbers
~ max → Ending number of a line of numbers -
functionality: returns numbers from
min
tomax
added to eachother -
Example:
Math.sum(1,5) --> 15
~ Complex
Tetration
-
name:
tetr
-
Arguments:
x (number), y (number)
~ x → Number to be tetrated
~ y -->The number thatx
is gonna be tetrated to -
functionality: returns x↑↑y (ʸx)
-
Example:
Math.tetr(2,3) --> 16
Pentation
-
name:
pent
-
Arguments:
x (number), y (number)
~ x → Number to be pentated
~ y -->The number thatx
is gonna be pentated to -
functionality: returns x↑↑↑y
-
Example:
Math.pent(2,3) --> 65536
Double Factorial
-
name:
dblfac
-
Arguments:
x (number)
~ x → Number thats double factorial is gonna be calculated -
functionality: returns x!!
-
Example:
Math.dblfac(3) --> 720
~ Download
As File
Download here: MathModuleV2
With Copy and Paste
Copy from here: …
local NewMath = {}
----> built-in
NewMath["random"]=math["random"]
NewMath["huge"]=math["huge"]
NewMath["abs"]=math["abs"]
NewMath["sqrt"]=math["sqrt"]
NewMath["min"]=math["min"]
NewMath["rad"]=math["rad"]
NewMath["sign"]=math["sign"]
NewMath["max"]=math["max"]
NewMath["sin"]=math["sin"]
NewMath["fmod"]=math["fmod"]
NewMath["round"]=math["round"]
NewMath["pi"]=math["pi"]
NewMath["cos"]=math["cos"]
NewMath["deg"]=math["deg"]
NewMath["exp"]=math["exp"]
NewMath["log"]=math["log"]
NewMath["pow"]=math["pow"]
NewMath["tan"]=math["tan"]
NewMath["acos"]=math["acos"]
NewMath["asin"]=math["asin"]
NewMath["atan"]=math["atan"]
NewMath["ceil"]=math["ceil"]
NewMath["cosh"]=math["cosh"]
NewMath["modf"]=math["modf"]
NewMath["sinh"]=math["sinh"]
NewMath["tanh"]=math["tanh"]
NewMath["atan2"]=math["atan2"]
NewMath["clamp"]=math["clamp"]
NewMath["floor"]=math["floor"]
NewMath["frexp"]=math["frexp"]
NewMath["ldexp"]=math["ldexp"]
NewMath["log10"]=math["log10"]
NewMath["noise"]=math["noise"]
NewMath["randomseed"]=math["randomseed"]
----> new
NewMath["tau"]=math.pi*2
NewMath["null"]=-math.huge
NewMath["euler"]=2.718281828459045
NewMath["phi"]=1.618033988749895
NewMath["nan"]=0/0
--> V2
NewMath["limit"]=2^1023.9999999999999
----> functions
NewMath["circum"]=function(r: number)
return NewMath.tau*r
end
NewMath["cbrt"]=function(x: number)
return x^(1/3)
end
NewMath["root"]=function(x: number,root: number)
return x^(1/root)
end
NewMath["fac"]=function(x: number)
local y = x
for i = 1,x-1 do
y=y*i
end
return y
end
NewMath["avg"]=function(...: number)
local n = 0
for _,i in pairs({...}) do
n += i
end
n /= #{...}
return n
end
NewMath["sum"]=function(min: number, max: number)
local n = 0
for i = min,max do
n += i
end
return n
end
--> COMPLEX
NewMath["tetr"]=function(x: number,y: number)
local n = x
for i = 1,y-1 do
n = x^n
end
return n
end
NewMath["pent"]=function(x: number,y: number)
local n = x
for i = 1,y-2 do
n = NewMath.tetr(n,x^n)
end
return n
end
NewMath["dblfac"]=function(x: number)
return NewMath.fac(NewMath.fac(x))
end
--> V2 COMPLEX
NewMath["trifac"]=function(x: number)
return NewMath.fac(NewMath.fac(NewMath.fac(x)))
end
return NewMath
As a model
Download here: MathModule - V2
~ Other
Found a mistake?
- Report it with answering to the post with the mistake quoted!
Have a feedback?
- Tell me and ill try to fix the module up!
Do you find this module useful?
- no
- maybe
- yea
0 voters