I need algorithm to calculate repayment rate of loan, based on following input data. 1. current loan balance 2. loan interest rate 3. number of days to first repayment 4. number of repayments. 5. repayment frequency (every 1 week, every 2 weeks, every month) capitalisation of interest is done at date of repayment. I need it as a function in PHP,Perl,Java,C++,Python (I prefer PHP), or math formula (in latex format or scanned paper). If you want to use some library function, it must be PHP. It woule be nice (but not neccesary) if you give me math proof that it's valid formula.
function in php or other languages mentioned above, or math formula as latex file or written and scanned paper.