Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you create a formula that has diminishing returns?

Tags:

function

math

I guess this is a math question and not a programming question, but what is a good way to create a formula that has diminishing returns?

Here are some example points on how I want the curve to look like.

f(1) = 1
f(1.5)= .98
f(2) = .95
f(2.5) = .9
f(3) = .8
f(4) = .7
f(5) = .6
f(10) = .5
f(20) = .25 

Notice that as the input gets higher, the percentage decreases rapidly. Is there any way to model a function that has a very smooth and accurate curve that says this?

Another way to say it is by using a real example. You know in Diablo II they have Magic Find? There are diminishing returns for magic find. If you get 100%, the real magic find is still 100%. But the more get, your actual magic find goes down. So much that say if you had 1200, your real magic find is probably 450%. So they have a function like:

actualMagicFind(magicFind) = // some way to reduced magic find
like image 647
egervari Avatar asked May 11 '10 18:05

egervari


People also ask

What is an example of a diminishing return?

As investment continues past that point, the return diminishes progressively. For example, the law of diminishing returns states that in a production process, adding more workers might initially increase output and eventually creates the optimal output per worker.


1 Answers

f(1) = 1
f(1.5)= .98
f(2) = .95
f(2.5) = .9
f(3) = .8
f(4) = .7
f(5) = .6
f(10) = .5
f(20) = .25

This doesn't make sense: for 3-5, adding one each time subtracts .1. With a real curve the output wouldn't be evenly spaced between any evenly spaced inputs. In other words, your curve is not a curve, as you can see by the graph: https://docs.google.com/spreadsheets/d/1EEbRxTyYalPSyQ93rcIbKiIvmYRX1lhRvkRh_HyofJc/edit?usp=sharing

So let's just ignore your "curve"; There are several ways to create diminishing returns. One of my favorites is:

f(x) = (x*a) / (x+b) + c

You can make a, b, and c anything you want. With this format a + c essentially* becomes your maximum possible output, c is your minimum, and b controls how quickly the output values scale and its effectiveness is relative to the value of a. This curve, of course increases the output as the input increases, whereas your example wants to decrease the output as the input increases. To fix this, you can swap the numerator and denominator:

f(x) = (x+b) / (x*a) + c

This makes the minimum output value equal to 1/a + c, the maximum output value approaches infinity as the input value approaches 0. b once again controls how quickly the output scales and its effectiveness is relative to the value of a.


Another approach would be to use something like what was mentioned by @Pierreten, though I'm not sure why he explicitly uses e:

a^(-bx)

Both a and b have a profound impact on how quickly the curve scales. If a is greater than 0 and less than 1, the output will increase as the input increases, but will also have the opposite effect, meaning it will have increasing returns, not diminishing. If a is greater than 1, then you'll see the desired effect of the output decreasing as the input increases with diminishing returns. The following is the closest thing I found to the numbers you described:

f(x) = 1.01^(-6.96607x)
f(0) = 1
f(1) = 0.933
f(3) = 0.812
f(10) = 0.5
f(20) = 0.25

There are several other options as well, but this is long enough.

like image 83
Joe Zim Avatar answered Sep 19 '22 16:09

Joe Zim