# On morgage payments

Cameron Laird claird at starbase.neosoft.com
Thu Oct 18 19:56:28 CEST 2001

```In article <mailman.1003414106.5819.python-list at python.org>,
>Isaw earlier a very inefficient way of calculating morgage on a loan.
>The recurence relation:
>
>P = amount
>i = interest
>d = downpayment
>
>P    = i*P    - d
>   n       n-1
>
>was solver by itteration in a loop
>
>I would like to point out:
>
>P     = i * (i*P     - d)  - d
>  i+1              i
>
>P       = i * ( i * (i * P   - d) -d) -d)
>  i + 2                     i
>
>
>P      = i*i*i*P  -d(i^2 + i +1)
>  i+2            i
>
>by inspecion i*i*i is a exponential and i^2 + i +1 is a geometric series so we have:
>
>P    = i^n * P    - d * (i^n -1 / i -1)
>  n               0
>
>Which can be computed once.
>
>

I can't interpret what appears above in any standard way
to yield internally-consistent results.  Rather than patch
up what I suspect is just mis-parenthesization, I offer

factor = (1 + i) ** n
payment = P * i * factor / (factor - 1)

as the most useful pertinent closed-form computation.
--

Cameron Laird <claird at NeoSoft.com>