Discount rates, Formulas - math

for example, I have 1 computer with a discount, the price of this computer is $ 450 with a 10% discount, I want to know the real price of it,
I want to learn this both over 10% and as 10% money.
Computer 10% off Price = 450$
Computer $10 off Price = 490$
$net_total = 450;
$discount_value = 10; < percent or amount
$gross_price = ?;

Well, let's solve the equations:
Computer 10% off Price = 450$
Computer $10 off Price = 490$
Which can be written as (let x be the initial price of the computer)
x - x * 10 / 100 = 450 # initial price - x without 10 % from x - x * 10% / 100%
x - 10 = 490 # just 10$ off
Or
0.9 * x = 450
x = 500
Finally
x = 450 / 0.9 = 500
x = 500
So from both equations we have that the initial computer's price is 500$
Edit: in general case,
if $discount_value stands for per cent (i.e. $discount_value = 10 means 10% discount) then
$gross_price = $net_total * 100.0 / (100.0 - $discount_value)
if $discount_value stands for money (i.e. $discount_value = 10 means 10$ discount), then
$gross_price = $net_total + $discount_value

Related

Reverse percentage to get actual amount

I ran into scenario where my client wants to know the original amount after percentage deduction. They are collecting online donation where user enter its amount and then percentage values (bank charges and FED) are added in his amount to ensure that my client always get exact amount in his account after percentage deduction.
For example:
Donation amount = 32,000
Bank charges = 3%
FED charges = 13%
Calculation:
Deducting bank charges = 32000 * .03 = 960
Deducting FED on bank charges = 960 * .13 = 124.80
Total = 32000 + 960 + 124.80 = 33,084.80
I now want to reverse the amount 33,084.80 to get the exact actual amount of 32,000.
Let Bank charges = b, FED charges = f (here b=0.03, f=0.13)
Then
Donation + Donation * b + Donation * b * f = Total
Donation * (1 + b + b * f) = Total
so
Donation = Total / (1 + b + b * f)
here
Donation = 33,084.80 / (1 + 0.03 + 0.03 * 0.13) = 33,084.80 / 1.0339 = 32,000

Looking for a logic to keep a fraction in a range

I need to write some code that can calculate a variable which shows the preference of a consumer to buy a component for his laptop. The preference changes by the tax (T) and the importance of prices on people's purchases (PriceI). I need to include both T and PriceI to find the person's willingness (W) for purchasing a laptop. Tax changes in a slider ranging from 50 Cent to $6 . I want to keep the variable W in a range from 1 to 2, where 1 is when the tax is on its default, minimum values which is 50 cent.
So There are 2 variables that have influence on W:
50<T<600
0.6 < PriceI < 9
Since I want 1<W<2, I thought it should work if I first normalize all the data by dividing them by their max, then in order to find a fraction to be between 1 and 2, I made the numerator to be less than 4 and the denominator to be less than 2, hoping to have the result between 1 to 2 :
to setup-WCalculator
ask consumers [
set PP ((PriceI / 9) * 2)
set TT ((T / 600) * 4)
set W TT / PP
]
end
However, Netlogo makes both PP and TT zero while they should be a small value like 0.15! Does the logic for finding W make sense?
Thanks,
Normalization is normally done with a formula such as
TT = (T - Tmin) / (Tmax - Tmin)
or here
TT = (T - 50) / (600 - 50)
That gives a normalized value between 0 and 1 as T ranges between 50 and 600. If you want TTT to range between 1 and x, where x is > 1, then you can set
TTT = 1.0 + TT * (x - 1.0)
So
TTT = 1.0 + TT * (4.0 - 1.0) = 1.0 + TT * 3.0
will give you a value between 1 and 4.

what is data transmission rate in bits per second ?

suppose that data are stored on 4.7 Mbytes CDs that weight 50 grams each.suppose that an airplane carries 10^4 kg of these CDs at a speed of 1500 km/h over a distance of 5000 km.what is data transmission rate in bits per second of this system?
I would not call this 'data-transmission', but:
Amount of CD's = 10^4 / 0.05 = 2e5
Amount of bits = 4.7e6 * 8 * amount of CD's = 7.52e12
Seconds to carry data = 5000e3 / (1500/3.6) = 12000 seconds
(7.52 * 10^12)/ 12000) = 0.6Gbits/s

Math for Buy X Get Y For Z

I'm working on a POS software that require a Buy X Get Y For Z discount schema, i.e: Buy 5 Get 2 For 5$, it means if you buy 7 items, 5 items are normal price and 2 items (6th, 7th) are 5$.
This is the spreadsheet for this https://docs.google.com/spreadsheets/d/1ym93Xqnw6wupBEp9ei711wQPpt3s6QONjcqBO4Xc5X4/edit#gid=0
I want to a algorithm to get X and Y (discounted item) when input quantity
i.e: input quantity and it will return X and Y for Buy 5 Get 2
input 7 return X = 5, Y= 2
input 8 return X = 6, Y= 2
..
input 17 return X= 13,Y= 4
I'm trying to find formula for this one but I'm failed. Please help me thanks
x = 5
y = 2
i = input
r = i % (x + y)
n = (i - r) / (x + y)
py = max(0, r - x) + (n * y)
px = i - py
return x = px, y = py
To explain, I'm setting r with the modulus/remainder of input / (x + y). This is the number remaining after completed offers are removed. I am then setting n to be the number of complete offers by subtracting the remainder from the input and dividing by (x + y). The variable py is then set using n * y for the number of items at the discounted price for completed offers and adding r - x if that is > 0. Finally px is the number of items at full price which is simply the input value - py.
In your spreadsheet, you have not implemented this correctly. Change as follows:
G2 =A2-F2
H2 =G2/($L$1+$L$2)
D2 =MAX(0,F2-$L$1)+H2*$L$2
E2 =A2-D2
For the offer "Buy x for $P and get y for $Q" you want to work out how many items can be bought at each price if you are buying q items in total.
The simplest approach is to iterate through each item, and figure out if it is bought at the cheaper price or the more expensive price -
qx = 0
qy = 0
for i = 0 : (q-1)
m = mod(i, x + y)
if m < x
qx = qx + 1
else
qy = qy + 1
end
end
Each item will be counted exactly once, so you are guaranteed that qx + qy = q.
I think it could work like this(for the option of BUY 5 GET 2 discounted, it could be generalized for other options):
int x = (input/7)*5;
int y = (input/7)*2;
if((input % 7) == 6){
x+=5;
y++;
}
else
x += (input % 7);
Where input is your total number of items x is number of full priced items and y of discounted items.
I'm treating the situation of having only one item discounted separately, but there might be way to deal with it easier.

Discount Calculation from a Range

Discount Calculation:
Product quantity and range
1 - 10 - 1%
11 - 20 - 2%
21 - 30 - 3%
31 - 40 - 4%
41 - 50 - 5%
the above are the quantity range and their discount% given,
for example:
each product cost is 100
if i purchase 50 product then 5% discount is 250
Now if i purchase 50 products at 2 terms let say 20 and 30 then
for 20 product 2% discount = 40
for 30 product 3% discount = 90
total discount = 130
but here i have to get discount as 250,
Problem description:
the product can be purchased in n number of terms for the maximum quantity, here maximum quantity is 50. discount% for the purchased product is given from the above range. when total discount is added it should be equal. here when 50 product is purchased 250 is given as discount same 250 should be total discount even when product purchased as 20, 10, 10 in terms or 25, 25 whatever.....
plz help me with the calculation part, with some formula or anything....
I assume that you want the discount rate to always increase as the number of purchased items increases, and if that's the case, there's no way to do this.
Here's the logic. The basic equation is:
n1d1 + n2d2 + n3d3 = (n1 + n2 + n3)dx
One obvious solution to this is to have all the d's being equal, that is, all the discount rates are the same. Otherwise, there's no general solution (that is, no set of d's that will work for all n combinations -- for example, whenever all but one of the n's are zero then the d's on both sides of the equation will have to be the same, so the only general solution is that all d's are the same), and if you want a specific solution with different d's, you could solve for the correct value of d given a set of n's, but when you do that, it's clear if one of the d's is smaller than dx, another will have to be larger, so you can't have an strictly increasing discount rate.
Calculate the discount for the previous item count. (How much discount has been given before.)
Calculate the discount for the new item count (previous + current order). (How much discount the customer should have.)
Give a final discount as the difference between the two values.
Store the new item count (of each type) for the customer to some database.
float SimpleDiscount(float cost, int count)
{
if (count <= 0) return 0;
if (count <= 10) return 0.01f * cost;
if (count <= 20) return 0.02f * cost;
if (count <= 30) return 0.03f * cost;
if (count <= 40) return 0.04f * cost;
return 0.05f * cost; // count > 40
}
float GetDiscount(int customerId, int itemId, int count)
{
float cost = GetItemCost(itemId);
int previousCount = GetCustomerOrderedItemCount(customerId, itemId);
float previousDiscount = SimpleDiscount(cost, previousCount);
int newCount = previousCount + count;
float newDiscount = SimpleDiscount(cost, newCount);
SaveCustomerOrderedItemCount(customerId, itemId, newCount);
return newDiscount - previousDiscount;
}
For example:
Item cost = 100
For 20 items: Discount = 40 (2%)
For 30 items: Discount = 210 (7%)
Total discount = 250 (5%)

Resources