How to make a mathematical curve as values get higher?

Hey there! I’m just looking for a way to kind of have a fall-off of values as another value increases. For example, lets say I have a machine that takes 5 seconds to produce an item and right now it has 5 levels each of which take a second off from the original. how would I use math to kind of add a fall-off curve the higher the levels go? Essentially a non-linear way to upgrade it.

What you’re referring to is exponential decay; as one value converges towards infinite, another value’s rate of change is decreased (decayed), in contrast, as the same value converges towards negative infinite, its rate of change is increased (grown).

3 Likes

so essentially y = ab^x? where a is the initial amount, b is the rate of decay, and x is the number of times decayed?

This seems to be a pretty good working model, although I wish I could get the rate of growth to exponentially decay over time in order to have the starting amounts change sharper.

local lvl = 1

local decay = .12

local amount = 5

while wait(.1) do

lvl += 1

print(math.ceil(amount*(1+decay)^lvl))

end
1 Like