HW1 Question2¶
Part A¶
In [7]:
annual_interest_rate = 0.05
monthly_interest_rate = annual_interest_rate/12
Total_of_months_for_the_mortgage = 360
In [9]:
print("Annual Interest Rate: ", annual_interest_rate)
print("Monthly Interest Rate: ", monthly_interest_rate)
print("Total Months: ", Total_of_months_for_the_mortgage)
Annual Interest Rate: 0.05 Monthly Interest Rate: 0.004166666666666667 Total Months: 360
Annual Interest Rate: 0.05
Monthly Interest Rate: 0.0042
Total Months: 360
Part B¶
In [49]:
Monthly_payments = [1000, 1500, 2000, 2500]
for payment in Monthly_payments:
# PV=C/r*(1-1/(1+r)^N)
pv = payment/monthly_interest_rate*(1-1/(1+monthly_interest_rate)**Total_of_months_for_the_mortgage)
rounded_pv = round(pv/1000) * 1000
print(f"For ${payment} per month, I can afford a house that costs ${rounded_pv}")
For $1000 per month, I can afford a house that costs $186000 For $1500 per month, I can afford a house that costs $279000 For $2000 per month, I can afford a house that costs $373000 For $2500 per month, I can afford a house that costs $466000
Part C¶
In [72]:
house_costs = 466000
exact_monthly_payment = house_costs * (monthly_interest_rate / (1 - (1 / (1 + monthly_interest_rate) ** Total_of_months_for_the_mortgage)))
print(f"Exact monthly payment: ${exact_monthly_payment:.2f}")
Exact monthly payment: $2501.59
In [68]:
first_month_interest = house_costs * monthly_interest_rate
first_month_principal = exact_monthly_payment - first_month_interest
print(f"First month principal: ${first_month_principal:.2f}")
print(f"First month interest: ${first_month_interest:.2f}")
First month principal: $559.92 First month interest: $1941.67
In [76]:
principal_remaining = house_costs
for month in range(60):
monthly_interest = round(principal_remaining * monthly_interest_rate, 2)
principal_paid = round(exact_monthly_payment - monthly_interest, 2)
principal_remaining = round(principal_remaining-principal_paid, 2)
print(f"Principal remaining: ${principal_remaining:.2f}")
Principal remaining: $427921.79
Part D¶
In [95]:
original_payment = exact_monthly_payment
principal_remaining = principal_remaining
refinance_rates = [0.035, 0.0375, 0.04, 0.0425, 0.045]
new_loan_term = 30 * 12
for rate in refinance_rates:
new_monthly_rate = rate / 12
# Calculate new monthly payment
new_monthly_payment = principal_remaining * (new_monthly_rate / (1 - (1 / (1 + new_monthly_rate) ** new_loan_term)))
new_monthly_payment = round(new_monthly_payment, 2)
monthly_savings = round(original_payment - new_monthly_payment, 2)
# print Refinancing monthly payment and whether it meets the conditions
print(f"New Payment at {rate * 100:.2f}% is ${new_monthly_payment:.2f}")
if monthly_savings >= 500:
months_to_breakeven = round(10000 / monthly_savings, 1)
print(f"We should refinance at {rate * 100:.2f}%.")
print(f"Monthly savings: ${monthly_savings:.2f}")
print(f"Months to recover $10,000 closing costs: {months_to_breakeven} months")
else:
print(f"We should NOT refinance at {rate * 100:.2f}% because the payment is not at least $500 lower.")
New Payment at 3.50% is $1921.56 We should refinance at 3.50%. Monthly savings: $580.03 Months to recover $10,000 closing costs: 17.2 months New Payment at 3.75% is $1981.77 We should refinance at 3.75%. Monthly savings: $519.82 Months to recover $10,000 closing costs: 19.2 months New Payment at 4.00% is $2042.96 We should NOT refinance at 4.00% because the payment is not at least $500 lower. New Payment at 4.25% is $2105.12 We should NOT refinance at 4.25% because the payment is not at least $500 lower. New Payment at 4.50% is $2168.22 We should NOT refinance at 4.50% because the payment is not at least $500 lower.
In [ ]: