I am trying to make a shop for self learning but i have a small hiccup!
I have this list of items that has a USD value assigned to it. But I want to make it so if they buy a "100 GB/s" it should be cheaper than buying 100 "1 GB/s" or 10 "10 GB/s". I have been trying for ages but i can't seem to figure it out.
Currently if they buy 100 of "1 GB/s" it will cost $7200 which is the value of one "100 GB/s"
If I'm unclear please write down below so I can explain further.
How do I do it?
100 MB/s = $8 200 MB/s = $14 300 MB/s = $22 400 MB/s = $29 500 MB/s = $36 600 MB/s = $43 700 MB/s = $50 800 MB/s = $58 900 MB/s = $65 1 GB/s = $72 2 GB/s = $144 3 GB/s = $216 4 GB/s = $288 5 GB/s = $360 6 GB/s = $432 7 GB/s = $504 8 GB/s = $576 9 GB/s = $648 10 GB/s = $720 11 GB/s = $792 12 GB/s = $864 13 GB/s = $936 14 GB/s = $1008 15 GB/s = $1080 20 GB/s = $1440 25 GB/s = $1800 30 GB/s = $2160 35 GB/s = $2520 40 GB/s = $2880 45 GB/s = $3240 50 GB/s = $3600 60 GB/s = $4320 70 GB/s = $5040 80 GB/s = $5760 90 GB/s = $6480 100 GB/s = $7200
One way to do this is to arrange that the unit price $p_N$ falls by a certain fraction $f$ when the quantity $N$ increases tenfold. This is a property of the function $$ p_N = p_1 N^{-k} $$ where $p_1$ is the price of one unit sold individually and $k$ is a constant.
$k$ is found by setting $$ 10^{-k} = 1 - f $$ which gives $$ k = -\log_{10}{(1-f)} $$
Example
$p_1 = \$72$ (the price of 1Gb/s)
$f=0.1$ (the unit price is reduced by 10% price for a tenfold increase in quantity)
With this data we find $$ k = -\log_{10}{(1-f)} = -\log_{10}{0.9} = 0.045757 $$
The unit price of a sale of 3Gb/s (N=3) is then $$ p_3 = p_1 3^{-k} = 72 \times 3^{-0.045757} = \$68.47005 $$ and the cost to the customer is $$ 3 p_3 = 3\times 68.47005 = 205.41 $$
As expected, the cost of 10Gb/s $(N=10)$ works out at \$648.00 (90% of \$720).