Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 137
Image: ubuntu2004
Kernel: Python 3 (system-wide)

Refinance Calculator

Suppose that you purchased an apartment for $260,000. You were able to put a %20 down payment, but needed to borrow the rest.

• Original Loan: The loan is a 30-year fixed rate mortgage with an annual interest rate, compounded monthly, of %5.2.

• Refinance Option: After 10 years of owing the apartment, a bank offers to refinance your loan as a 30-year fixed rate mortgage with an annual interest rate, compounded monthly, of %3.3 with an estimated closing cost of $10,000.

Conclusion

Refinancing is the most worthwhile option. Although it will extend the mortgage payments length by another ten years, the monthly payments will be substantially lower and the total interest paid will be almost half of the original loan.

purchaseAmount=260000 downPayment=.20 loanLength=30 interestRate=0.052 compoundedMonthly=12 refinancedInterestRate=0.033 def monthlyPayments(p, l, i, c): n=l*c r=i/c M=p*r*(((1+(r))**(n))/(((1+(r))**(n))-1)) return M def compoundPrincipal(p, l, i, c): n=l*c r=i/c M=p*r*(((1+(r))**(n))/(((1+(r))**(n))-1)) A=M*l*c return A def outstandingBalance(p, l, i, c, t): n=l*c m=t*c r=i/c O=p*(((1+r)**(n))-((1+r)**(m)))/(((1+r)**(n))-1) return O originalMonthlyPayments=monthlyPayments((purchaseAmount-purchaseAmount*downPayment),loanLength,interestRate,compoundedMonthly) originalOutstandingBalance=outstandingBalance((purchaseAmount-purchaseAmount*downPayment),loanLength,interestRate,compoundedMonthly, 10) originalPrincipal=compoundPrincipal((purchaseAmount-purchaseAmount*downPayment),loanLength,interestRate,compoundedMonthly) refinancedMonthlyPayments=monthlyPayments(originalOutstandingBalance,loanLength,refinancedInterestRate,compoundedMonthly) refinancedPrincipal=compoundPrincipal(originalOutstandingBalance,loanLength,refinancedInterestRate,compoundedMonthly) print(" ORIGINAL LOAN", '\n', "-------------------------", '\n', '\n') print("Loan amount: $", round(purchaseAmount-(downPayment*purchaseAmount)), '\n') print("Loan term (years):", loanLength, '\n') print("Interest rate: ", round(interestRate*100, 2), "%", '\n') print("Monthly payments: $" ,round(originalMonthlyPayments, 2), '\n') print("Principal: $",round(purchaseAmount-(downPayment*purchaseAmount)), '\n') print("Total interest: $", round(originalPrincipal-(purchaseAmount-(downPayment*purchaseAmount)), 2), '\n') print("Mortgage total: $", round(originalPrincipal, 2), '\n', '\n') print("Outstanding balance after 10 years: $", round(originalOutstandingBalance, 2), '\n', '\n') print(" REFINANCED LOAN", '\n', "-------------------------", '\n', '\n') print("Loan amount: $", round(originalOutstandingBalance, 2), '\n') print("Monthly payments: $" ,round(refinancedMonthlyPayments, 2), '\n') print("Loan term (years):", loanLength, '\n') print("Interest rate: ", round(refinancedInterestRate*100, 2), "%", '\n') print("Monthly payments: $" ,round(refinancedMonthlyPayments, 2), '\n') print("Principal: $",round(originalOutstandingBalance, 2), '\n') print("Total interest: $", round((refinancedPrincipal-originalOutstandingBalance), 2), '\n') print("Mortgage total: $", round(refinancedPrincipal, 2), '\n', '\n')
ORIGINAL LOAN ------------------------- Loan amount: $ 208000 Loan term (years): 30 Interest rate: 5.2 % Monthly payments: $ 1142.15 Principal: $ 208000 Total interest: $ 203174.23 Mortgage total: $ 411174.23 Outstanding balance after 10 years: $ 170202.48 REFINANCED LOAN ------------------------- Loan amount: $ 170202.48 Monthly payments: $ 745.41 Loan term (years): 30 Interest rate: 3.3 % Monthly payments: $ 745.41 Principal: $ 170202.48 Total interest: $ 98145.35 Mortgage total: $ 268347.83