05-17-2015, 03:52 PM
hi all,
here a simple program to calculate the effective and nominal interest rate (both finite and compound)
effective_rate(nominal, compound), eff_cont_rate(nominal), nominal_rate(effective, compound), nominal_cont_rate(effective)
simp_comp(sint,t)
comp_simp(cint,t)
The rates (effective and nominal) must me entered in decimal: i.e. 0.05 (5%), 0.12 (12%), compound period are i.e. 12 or 4, 3, and so on...
simp_comp and comp_simp convert to and from simple and compound rate (i.e. 0.13), t is the period of time.
Enjoy!
Salvo M.
here a simple program to calculate the effective and nominal interest rate (both finite and compound)
effective_rate(nominal, compound), eff_cont_rate(nominal), nominal_rate(effective, compound), nominal_cont_rate(effective)
simp_comp(sint,t)
comp_simp(cint,t)
The rates (effective and nominal) must me entered in decimal: i.e. 0.05 (5%), 0.12 (12%), compound period are i.e. 12 or 4, 3, and so on...
simp_comp and comp_simp convert to and from simple and compound rate (i.e. 0.13), t is the period of time.
Enjoy!
Salvo M.
Code:
EXPORT effective_rate(nominal, compound)
// Finite (simplex) compounding
// nominal = nominal rate (i.e. 0.05), compound = number of compounding period per year (i.e. 12)
BEGIN
local effective;
effective:= ((1+ nominal/compound)^compound - 1);
return effective;
END;
EXPORT eff_cont__rate(nominal)
// Continous compounding
// nominal = nominal rate (i.e. 0.05)
BEGIN
local effective;
effective:= ((e^nominal) - 1);
return effective;
END;
EXPORT nominal_rate(effective, compound)
// Finite (simplex) compounding
// effective = effective rate (i.e. 0.05), compound = number of compounding period per year (i.e. 12)
BEGIN
local nominal;
nominal:= ((effective + 1)^(1/compound)-1)*compound;
return nominal;
END;
EXPORT nominal_cont__rate(effective)
// Continous compounding
// effective = effective rate (i.e. 0.05)
BEGIN
local nominal;
nominal:= LN(effective + 1);
return nominal;
END;
EXPORT simp_comp(sint,t)
// Simple inerest (i.e. 0.05) to compound interest, t = period
BEGIN
local cint;
cint:= ((1+sint*t)^(1/t))-1;
RETURN cint;
END;
EXPORT comp_simp(cint, t)
// Compound interest (i.e. 0.05) to simple, t = period
BEGIN
local sint;
sint:= ((1+cint)^t-1)/t;
RETURN sint;
END;