Diminishing returns = decreasing derivative
- Since you still want some returns even at higher levels means that the derivative should be positive, otherwise building more farms would decrease the food production (which might even make sense if you take into account logistics and upkeep costs)
- It should approach zero assymptotically, if it goes towards a non-zero value you will end up with constant increase per farm at some level
- depending on how fast it goes to zero you can have an upper limit or an unbounded function
So what do you need to do? Pick a function that fits the above criteria and integrate it.
The simplest choice for this task is g(t,n) = 1/(t+1)^n
where n=1
marks the boundary between ever increasing and bounded functions.
The integral of g from 0 to x is what you need: f(x,n) = ((x+1)**(1-n) - 1)/(1-n)
Here is how it looks for different n
And here its normalized to the same final value
By changing the exponent n
you can easily adjust the balancing
Note: The derivative here is the production per farm, while the integral is the total production for a number of farms