in reply to Monthly Payment Analyzer

See Payments calculator for more accurate formulas including how I derived them and a complete script that makes use of them (including checking the results).

                - tye
  • Comment on Re: Monthly Payment Analyzer (formulas)

Replies are listed 'Best First'.
Re: Re: Monthly Payment Analyzer (formulas)
by sulfericacid (Deacon) on Apr 01, 2003 at 19:11 UTC
    I took a look at your code and was overwhelmed at not being able to understand most of it. Honestly that is the most difficult code to follow as I've ever come across, no offense cause I still don't really understand all that much the way it is. Like for example:
    L= sum<j=0..N-1>( r^j ) L= 1+r+..+r^(N-1) r*L - L = r*( 1+r+..+r^(N-2)+r^(N-1) ) - ( 1+r+..+r^(N-1) ) r*L - L = ( r+r^2+..+r^(N-1)+r^N ) - ( 1+r+..+r^(N-1) ) r*L - L = r+r^2+..+r^(N-1) + r^N - ( 1 + r+..+r^(N-1) ) r*L - L = r+r^2+..+r^(N-1) + r^N - 1 - ( r+..+r^(N-1) )
    Holy cow, it looks like I opened a binary file in notepad :) You're saying your script is more accurate than mine but is my equation and everything suffient anyways? This wasn't meant to be dead accurate, just to help my girlfriend with her homework.

    Thanks!

    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid

      That isn't code. Those are comments showing how the relatively simple equation was derived. Namely:

      p = P * r^N / [ (r^N-1) / (r-1) ]
      where
      r = (1+i/f)

      I didn't look at your code in detail. Looking more closely now, I would say that either your concept of "interest" incorporates much more than the interest rate that would normally be quoted when getting a loan or your code is simplistic to the point of being very inaccurate.

      Try running my script with some sample data and compare it to your script if you want to get a better idea of how much difference there is.

      Note that my script wants the simple interest rate for the loan. This is not "APR" (Annual Percentage Rate) which takes into account how the simple interest is compounded.

      So a simple 8% loan with interest compounded monthly would have an APR of 100*( (1+0.08/12)^12 - 1 )% or about 8.3%. For such a loan, you'd tell my script "8%".

      Note that ^ is used for exponentiation in the math equations I've shown and you'd use ** instead if writing similar code in Perl.

      A somewhat simpler equation that I've seen loan officers use makes the assumption that you'll pay about 1/2 as much interest in paying off the loan as would accrue if you made no payments. Or:

      p = P * [ (1+i/f)^N + 1 ] / 2
      This equation is much simpler to derive, but is only a little simpler to use than my very accurate one, so I don't use it. I'm not sure why loan officers use it, since I doubt they care whether or not they know how to derive the formula. Perhaps it is easier to use with a typical adding machine?

                      - tye

      That's pseudo code in the documentation. It's what tye described as the derivation of his formulae.

      --
      Clayton aka "Tex"