Ok... back again... you are not kidding about the APR
formula, yikes.
I merged your code with another attempt, in the form of a
cfscript, and it is working
great to show the monthly payment
<cfscript>
loanAmount = #form.LoanAmount#;
extraCost = #totalClosingCosts#;
interestRateAnnual = #loanRate#;
origIntRate = interestRateAnnual/1200;
loanMonths = #loanTerm#*12;
monthlyPaymentsNum = (loanAmount+extraCost)* origIntRate *
((1+origIntRate)^loanMonths);
monthlyPaymentsDen = ((1+origIntRate)^loanMonths)-1;
monthlyPayments = monthlyPaymentsNum / monthlyPaymentsDen;
</cfscript>
But now, I need to find the APR.
Here is one formula that shows it 'in reverse'.. in other
words, the equation must be solved to find the missing variable..
and
I have no idea how to do that in CF.
http://www.efunda.com/formulae/finance/loan_calculator.cfm
What I need to do is use 'scenario #2'
Any ideas how to approach that?
--
Michael Evangelista
Evangelista Design / Evangelista Consulting, inc.
www.evangelista-web.com
Custom Small Business Website Solutions
"Hal B. Helms" <webforumsuser@macromedia.com> wrote in
message news:ecr6or$72k$1@forums.macromedia.com...
> Here's the formula for doing the monthly payment. The
APR is going to be
> considerably harder, as it requires iterative
approximations.
>
> <cfset loanAmount = 200000 />
> <cfset extraCost = 5000 />
> <cfset interestRate = 7.5/1200 />
> <cfset numberOfMonths = 360 />
>
> <cfset monthlyPayment = ((loanAmount + extraCost) *
interestRate * ((1 +
> interestRate)^numberOfMonths)) / (((1 +
interestRate)^numberOfMonths) - 1) />
>
> <cfoutput>
> #monthlyPayment#
> </cfoutput>
>