If you want a periodic equivalent interest rate that compounds to your annual rate...
// return the equivalent, compound interest rate for an annual interest
// rate of {annualRate} for time periods {noOfPeriods}, e.g.,
// noOfPeriods = 12 ==> monthly, noOfPeriods = 4 ==> quarterly, etc.
public double getPeriodicCompoundRate(double annualRate, double noOfPeriods) {
// division by zero is illegal - virtuous callers should
// check return to ensure error value was not returned
if (0 == noOfPeriod) return -999;
// calculate per period compound rate
return Math.pow(annualRate, 1/noOfPeriods);
}
If you want a periodic simple interest rate based on your annual rate...
// return the simple interest rate for an annual interest
// rate of {annualRate} for time periods {noOfPeriods}, e.g.,
// noOfPeriods = 12 ==> monthly, noOfPeriods = 4 ==> quarterly, etc.
public double getPeriodicSimpleRate(double annualRate, double noOfPeriods) {
// division by zero is illegal - virtuous callers should
// check return to ensure error value was not returned
if (0 == noOfPeriod) return -999;
// calculate per period compound rate
return annualRate/noOfPeriods;
}