I am a programmer interning at a small contract furniture company. This company receives multiple discounts from the manufacturers, and I am trying to calculate the end discount. For example, the first discount is 50%, the second discount is 20% off that price, and the third is 20% of that, then the total discount is 68%. They already have an Excel worksheet that calculates this, but I want to write a recursive function that can perform this calculation as many times as is necessary. My question is; what is this type of discounting called?
This is in general simply referred to as compounding. In functional terms, consider the inefficient python code below
def total_discount(rates): return (1.0 - discount(1.0, rates))*100.0 def discount(original, rates): if len(rates) == 1: return (1.0-rates/100.0)*original else: return (1.0-rates/100.0)*discount(original, rates[1:])
This type of thing is often seen in forward rates.