View Single Post

#1
Bookmark and Share!
Finance Calculator
Old 2005-09-15

Hi

I'm trying to do a finance calculator in flash. Quite a simple application, but I have no PMT function (as you get in excel), so I need the PMT function, but can't find it anywhere.

It's for a car site, to work out what the user can afford as total price for a vehicle. There are some fixed amounts, which just gets added to the amount I'm trying to work out.

I've got the following functions from another site:

function rate(principal, periods, payment) {
myrate = 0;
increment = 0.1;
decimals = 0
while(pmt(principal,myrate,periods) != payment && decimals < 9) {
while(pmt(principal, myrate, periods) < payment) {
myrate = myrate+increment;
}
myrate = myrate-increment;
increment = increment/10;
decimals++;
}
myrate = math.round(myrate*100000000)/100000000;
return myrate;
}

function pmt(principal, rate, periods) {
if(rate == 0) {
mypayment = principal/periods;
} else {
mypayment = principal*(rate/12) / (1-1/math.pow(1+rate/12,periods));
}
return mypayment;
}

I just can't seem to work out the principal, which I think is the value I'm after. Would be grateful if anyone can have a look at this and give me the formula/function for working out the principal.

Regards
MtraX
http://mtrax.iuma.com - play
http://www.webdesignsouthafrica.co.za - work
postbit arrow 3 comments | 365 views postbit arrow Reply: with Quote   
MtraX
Registered User
MtraX is offline
seperator
Posts: 8
2002-07-23
Age: 34
seperator

Ultrashock Member Comments: