A function that is between linear and exponential growth for script

Hi i need a function for my Roblox game that you give a number like 200 and gives a higher number.
The output should not be linear (e.x. 200, 201, 202, 203 is a linear output)
The output should also not be exponential (e.x. 100, 2800, 78400, 2195200)
What i want is a function that is grows faster than linear and that is is exponential but that is doesn’t so so fast up.
I need this so i can grow the price of a thing in my game.

1 Like

If you want something linear but with larger growth, could you not just use the m part of the linear equation y = mx+b? You know, like cost = (level * costPerLevel) + initialCost? Same with exponential growth, if you want an equation that doesn’t go up very quickly, then couldn’t you just modify the exponent you’re working with?

I’m not a very math oriented person but I think you could probably settle here. If you find that the increment you’re using is too high, try applying other operations to try and lower your exponent or offset or just use smaller numbers. I mean, “something between exponential and linear” is probably a wordy way of saying a smaller exponent.

A simple equation like 100 * b^2 could work, but I don’t know too much about the parameters you’re working with here. 100 represents the initial cost (a constant), b is your base value (in this case, I don’t know, the level of the item being purchased?) and the 2 is the exponent to be using on the base. Might not follow the spirit of exponential growth but it’s something.

By the way: the first 10 iterations of this equation (not including 0 of course, because then the cost would be 0 and that’d be 11 iterations) will produce the following values: 100, 400, 900, 1600, 2500, 3600, 4900, 6400, 8100, 10000.

1 Like

8 posts were split to a new topic: Feedback - DM instead of Replying

I’m going to say it on the thread itself instead then: please don’t minimod. You can raise issues with threads in private or flag them if you believe they are not a right fit for the category.

OP is only asking for mathematical help, not to give them full code pieces. Guiding words are appropriate to give here and the thread is okay to be here. Please don’t fill up the replies with disagreements about the way OP posts. Let’s keep things on topic.

2 Likes

Could be referring to this rather than a code function. Exponential growth is a mathematical function (an exponential function, specifically). :slight_smile:

1 Like

It’s odd that you haven’t mentioned the quadratic function (1, 2, 4, 9, 16, 25…) (which is also what patfre showed)

You also don’t have to be stuck with the scale of the curve you get. If you put y = x and y = x^2 on one page, the latter will seem way out of control. But replace it with y = 0.6 * x^1.2, i.e. reduce the exponent a little and shrink it down, and it’s a lot more manageable. Or y = 0.6 * (x + 10)^1.2 - 15, where I shift the whole thing over to get a different part of the curve

In any case, there are a bunch more functions that grow and whose rate of growth grows. Look for parts of HS textbooks about differentials or integration… you don’t have to understand these things, just that the cheatsheets for them have a lot of different functions that you can try, all in one place.

It helps to have a graphing calculator that can show many plots side by side, such as GeoGebra.

edit:

A function that is between linear and exponential growth

This is exponential growth: y = n^x
x grows at a constant rate.
This function doesn’t grow as fast: y = n^log(x)
because log(x)'s rate of growth decreases. It can be replaced with whatever other function you can find that grows, but whose rate of growth decreases, such as x^0.1.

1 Like