View Full Version : APR Calculator help ><

03-14-2009, 04:49 AM
I posted earlier today looking for some help making a calculator for the school project Im working on, the problem is that I need to use the Newton-Raphson method on the APR calculator Im trying to make. Below is a link to my site (the original is hosted on Blackboard) that has the formulas on it. Any help or pointers would be awesome, this thing is just being a huge pain, I got the first part of the equation down, heres the link:
and heres my code:

function stripComma(val) {
return val.replace(/[,\s]/gi,'');

function apr() {
var loan = stripComma($('loanamount').value);
loan = Number(loan);
var rate = stripComma($('intrestrate').value);
rate = Number(rate);
var months = stripComma($('monthnum').value);
months = Number(months);
var extra = stripComma($('extra').value);
extra = Number(extra);

if(loan == '' || extra == '' || rate == '' || months == '' )
alert ('Please be sure to fill in ALL of the required fields!');
//this does the first steps in calculating the APR by finding the monthly payments as per the directions
rate = rate /1200;
newrate = rate + 1;
newrate = Math.pow(newrate, months);
extra = extra + loan;
extra = extra * rate;
extra = extra * newrate;
bottomnum = newrate - 1;
payments = exta / bottomnum;

Thx again all