Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compound Interest (code attached) accrued mid terms int.
Message
From
11/09/2004 11:35:06
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00941298
Message ID:
00941325
Views:
9
Perhaps the following brief explanation of compound interest can help clarify the situation.

Let's assume you have an annual interest (compound) of 10%. If you start with $100, after one year you will have $110. This is the same as multiplying by 1.1 (1 + 10/100, where 10 is the interest in percent).

After three years (for example), you will have 100 * 1.1 * 1.1 * 1.1 = 100 * 1.1 ^ 3.

The interesting part is that you can also apply the power to fractions of a year. For example, the factor for the daily increase is 1.1 ^ (1/365), assuming that you use years of 365 days. That is, you can easily convert yearly interest to daily interest.

Now, it is also a matter of policies, how interests will be handled on a daily basis. Do you apply the interest only at the end of the month, or of the weak, or every day? Do you use "years" of 360 days for your calculations? (This might be a residue from a period when the Earth was in a different orbit!)

>Hi all
>
>I have the following code to calculate different types of compound interests for the basic given values. The best fit calculation in my case is the quaterly calculation, which gives the final amount as it is on the official document. The thing to notice is that all these calculations assume that each year starts from 23/03 (american 03/23) every year.
>
>Now the problem arises when I have to calculate mid term interest as for a financial year 01/04/2003 upto 31/03/2004 (04/01/2003 upto 03/31/2004) or a worst case 15/06/2003 to 05/07/2003 (06/15/2003 to 07/05/2003). And what will happen for leap years??? Or in case where the deposit has just been made in the current financial year (in the below eg. a FY calc of 01/04/2002 to 31/03/2003 where the deposit will be for only for 9 days).
>
>Please help.
>
>
LOCAL ldStDt, ldEnDt, lnPrinciple, lnRate, lnConstant, lnFreq1, lnFreq2, ;
>	lnFreq4, lnFreq6, lnFreq12, lnFreq24, lnFreq26, lnFreq52, lnFreq360, lnFreq365
>
>ldStDt = {^2002-03-23}
>ldEnDt = {^2005-03-23}
>lnPrinciple = 125000
>lnRate = 8.75 /100
>lnConstant = 2.71828182845
>lnFreq1 = 1 && yearly
>lnFreq2 = 2 && semianually
>lnFreq4 = 4 && quaterley
>lnFreq6 = 6 && bimonthly
>lnFreq12 = 12 && monthly
>lnFreq24 = 24 && semimonthly
>lnFreq26 = 26 && biweekly
>lnFreq52 = 52 && weekly
>lnFreq360 = 360 && daily (360)
>lnFreq365 = 365 && daily (365)
>
>?
>?
>? "Principle", lnPrinciple, "Rate", lnRate * 100, "Dtd.", ldStDt, "Maturity", ldEnDt
>?
>
>FOR m.t = 1 TO 3
>	? "Year", m.t
>	? "yearly" + CHR(9) + CHR(9), ROUND(lnPrinciple * (1 + (lnRate / lnFreq1)) ^ (lnFreq1 * m.t), 0)
>	? "semianually" + CHR(9), ROUND(lnPrinciple * (1 + (lnRate / lnFreq2)) ^ (lnFreq2 * m.t), 0)
>	? "quaterly" + CHR(9), ROUND(lnPrinciple * (1 + (lnRate / lnFreq4)) ^ (lnFreq4 * m.t), 0)
>	? "bimonthly" + CHR(9), ROUND(lnPrinciple * (1 + (lnRate / lnFreq6)) ^ (lnFreq6 * m.t), 0)
>	? "monthly" + CHR(9), ROUND(lnPrinciple * (1 + (lnRate / lnFreq12)) ^ (lnFreq12 * m.t), 0)
>	? "semimonthly" + CHR(9), ROUND(lnPrinciple * (1 + (lnRate / lnFreq24)) ^ (lnFreq24 * m.t), 0)
>	? "biweekly" + CHR(9), ROUND(lnPrinciple * (1 + (lnRate / lnFreq26)) ^ (lnFreq26 * m.t), 0)
>	? "weekly" + CHR(9), ROUND(lnPrinciple * (1 + (lnRate / lnFreq52)) ^ (lnFreq52 * m.t), 0)
>	? "360" + CHR(9) + CHR(9), ROUND(lnPrinciple * (1 + (lnRate / lnFreq360)) ^ (lnFreq360 * m.t), 0)
>	? "365" + CHR(9) + CHR(9), ROUND(lnPrinciple * (1 + (lnRate / lnFreq365)) ^ (lnFreq365 * m.t), 0)
>	? "Continous", ROUND(lnPrinciple * (lnConstant ^ (lnRate * m.t)), 0)
>	?
>ENDFOR
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform