Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Progressive non-linear algorithm for increasing discount

Tags:

algorithm

math

A system has to support 100 users and the price for support is 3

A system has to support 10 000 users and the price for support is 1

I have to devise an algorithm to give me the price in between so it will gradually rise with the number of users.

I tried to multiply the number of users by 0.0002 to get the discount value and I got

300 users * 0.0002 = 0.06 discount, so price for support = 2.94 total income = 300 * 2.94 = 882

5000 users * 0.0002 = 1 discount, so price for support = 2 total income = 5000 * 2 = 10 000

8000 users * 0.0002 = 1.6 discount, so price for support = 1.4 total income = 8000 * 1.4 = 11 200

10 000 users * 0.0002 = 2 discount, so price for support = 1 total income = 8000 * 1.4 = 10 000

So you see after a given point I am actually having more users but receiving less payment.

I am not a mathematician and I now this is not really a programming question, but I don't know where else to ask this. I will appreciate if someone can help me with any information. Thanks!

like image 327
Boris Hamanov Avatar asked Mar 16 '26 12:03

Boris Hamanov


1 Answers

price = n * (5 - log10(n)) will work for 100 < n < 10000.

Just make sure you're using base-10 log and not natural (base-e) log. If your language doesn't have base-10 log normally, you can calculate it like this:
function log10(x) { return log(x)/log(10); }.

For 100 users, that's 100 * (5 - log10(100)), which gives 100 * (5 - 2), which is 300.

For 1000 users, that's 1000 * (5 - log10(1000)), which gives 1000 * (5 - 3), which is 2000.

For 10000 users, that's 10000 * (5 - log10(10000)), which gives 10000 * (5 - 4), which is 10000.

Let's pick some more random figures.
2500 users: 2500 * (5 - log10(2500)) gives us 2500 * (5 - 3.39794), which is 4005.
6500 users: 6500 * (5 - log10(6500)) gives us 6500 * (5 - 3.81291), which is 7716.
8000 users: 8000 * (5 - log10(8000)) gives us 8000 * (5 - 3.90309), which is 8775.

Should work out about right for what you're modelling.

like image 130
Polynomial Avatar answered Mar 19 '26 15:03

Polynomial