I would like how to know how inverse can be used
Could I use it like this?
local i = 0 function Example() if i > 1 then i = i:inverse end print(i) end Example()
"Inverse" is a term from mathematics that has two meanings:
The inverse function of a function "undoes" that function. i.e., if F
is the inverse of f
, then F(f(x))
should be the same as x
. Examples:
*x^2
is the inverse of math.sqrt(x)
* math.acos
the inverse of math.cos
* math.sin
the inverse of math.asin
.
Not all functions are invertible (meaning some functions don't have inverses)
The identity of an operation is the1 value that "does nothing" to other values:
+
(for numbers) is 0
since x + 0
is x
*
(for numbers) is 1
since x * 1
is x
*
(for CFrames) is CFrame.new(0, 0, 0)
since x * CFrame.new()
is x
+
(for Vector3s) is Vector3.new(0, 0, 0)
since x + Vector3.new()
is x
The inverse of a value x
with respect to an operation is the value y
that "cancels" with x
yielding the identity of that operation.
Not all values have inverses.
x
with respect to +
(for numbers) is -x
since x + -x
is 0
, the additive identityx
with respect to *
(for numbers) is 1/x
or x^-1
since x * 1/x
is 1
, the multiplicative identity. 0
does not have a multiplicative inversex
with respect to +
(for Vector3s) is -x
since x + -x
is Vector3.new(0, 0, 0)
, the additive identityx
with respect to *
(for CFrames) is x:inverse()
since x * x:inverse()
is CFrame.new()
, the multiplicative identity of CFramesidentities are unique ↩
As i read in the comments, the thing you want is:
Value = -Value
Your question is about :inverse, wich is a method that can be called on CFrames.
As tested in roblox studio:
v = 2 print(-v), prints -2
v = -2 print(-v), prints 2