----- Original Message ----- From: "Kerry Thompson" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Saturday, September 15, 2007 7:48 AM
Subject: [Flashcoders] Compound interest formula


I'm ok with math, but it's not my strong suite.

Does somebody have the compound interest formula, preferably in AS2 form?

It comes in various forms. The one I need is, given an interest rate, a
period of time, and an end goal, what monthly payments do you need to make.

In other words, assuming 8% annual return, and you want $1,000,000 in 25
years, how much do you need to set aside each month?


Here it is in Lingo (from my book - sorry some line breaks have come in, I'm on a computer with no Director so I had to cut and paste from the documentation). The second function is the one you're looking for (but it calls the first one).

Danny

on mortgage am, pc, pay, tp
--! ARGUMENTS:
am (loan amount), pc (APR), pay (monthly payment),
--! tp
(#monthly, #mixed or #yearly (default), the detail required
for output)
--! RETURNS: a string giving the rate of repayment
on a (capital and repayment) mortgage
set the floatprecision
to 2 -- (ensures two decimal place output)
-- set the monthly
interest, as a fraction 1+APR/1200
pc=1+pc/(1200.0)

i=0
oldam=am
ret=""
repeat while am>0
i=i+1

-- each month, increase the loan by the monthly interest, and
decrease it by the fixed payment
am=pc*am - pay
if am<=0
then
-- if the amount is less than or equal to zero then
the loan has been repayed
put "At the end of month"&&i&&"the
loan is $0"&return after ret
-- we can also calculate the
total money paid in interest
put "You have paid $"&(i*pay-oldam+am)&&"in
interest." after ret
am=0
else
if (i mod 12) = 0
then tx="year"&&i/12
else tx="month"&&i
if tp=#monthly
or (tp=#mixed and i<12) or ((i mod 12) =0) then
put
"At the end of"&&tx&&"the loan is $"&am&return after ret


end if

end if
end repeat
return ret
end

--------------------------------------------------------------------------------
on mortgagecalc am, pc, yr
--!
ARGUMENTS: am (loan amount), pc (APR), yr (number of years),

--! RETURNS: a string giving the monthly payment for a (capital
and repayment) mortgage
at the given APR
i = 1+pc/1200.0
mth=yr*12
pow=power(i,mth)

pay=am*pow*(i-1)/(pow-1)
put "Monthly payment is"&&pay

mortgage(am,pc,pay,#year)
end
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to