Refactor monthly totals
This commit is contained in:
parent
4280ae7585
commit
967d7d594d
@ -23,28 +23,29 @@ P * (1-(1+r)^-n) = r * PV
|
||||
|#
|
||||
|
||||
(defun find-payments (loan-total rate number-of-payments)
|
||||
"Base loan calculation"
|
||||
"Generic payment calculation"
|
||||
(/ (* rate loan-total)
|
||||
(- 1 (expt (+ 1 rate) (* number-of-payments -1)))))
|
||||
|
||||
(defun find-monthly-payments(loan-total rate number-of-payments)
|
||||
"Modify loan calculation to show monthly payments"
|
||||
"Monthly payment by loan/rate/number of years"
|
||||
(find-payments loan-total (/ rate 12) (* number-of-payments 12)))
|
||||
|
||||
(defun find-montly-payment-total-per-year (loan-total rate number-of-payments)
|
||||
"Modify loan calculation to show total montly payments per year"
|
||||
(* (find-payments loan-total (/ rate 12) (* number-of-payments 12)) 12))
|
||||
(defun find-monthly-payment-total-per-year (loan-total rate number-of-payments)
|
||||
"Total monthly payments per year"
|
||||
(* (find-monthly-payments loan-total rate number-of-payments) 12))
|
||||
|
||||
|
||||
;; fixme: add function to take monthly-payments rate num-of-payments
|
||||
(defun find-biggest-loan (payments rate number-of-payments)
|
||||
"Base loan calculation"
|
||||
"Generic loan calculation"
|
||||
(/ (* payments
|
||||
(- 1 (expt (+ 1 rate)
|
||||
(* -1 number-of-payments))))
|
||||
(- 1
|
||||
(expt (+ 1 rate) (* -1 number-of-payments))))
|
||||
rate))
|
||||
|
||||
(defun find-biggest-loan-monthly (payments rate number-of-payments)
|
||||
"Largest loan by payments/interest rate/number of years"
|
||||
(find-biggest-loan payments (/ rate 12) (* number-of-payments 12)))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user