[PYTHON] What is equal repayment of principal and interest and equal repayment of principal and interest?

There are two ways to repay a mortgage. Even when I read the book, I felt uncomfortable with only the figures that I could not understand, so I tried to express it with mathematical formulas.

Reference example that I personally found difficult to understand

http://www.flat35.com/faq/faq_208-4.html

100010279.gif

What is equal repayment of principal and interest?

It is a repayment method in which "fixing the monthly repayment amount" is given top priority, and the amount obtained by subtracting interest from it is used for the principal.

months = range(0, 35 * 12)
residual =  36000000
r = 0.012
fixed = 120000

hist_residual = []
hist_reduction = []
hist_interst = []
hist_month = []

for month in months:
    if residual < 0: break
    reduction = fixed - residual * r / 12.0
    residual = residual - reduction
    
    hist_month.append(month)
    hist_residual.append(residual)
    hist_reduction.append(reduction)
    hist_interst.append(residual * r / 12.0)
    
fig, axs = plt.subplots(2, sharex=True)
axs[0].plot(hist_month, hist_residual)
axs[0].set_ylabel('residual')
axs[1].stackplot(hist_month, [hist_reduction, hist_interst], colors=['blue', 'pink'], labels=['residual', 'interest'])
axs[1].set_xlabel('month')
axs[1].legend()

ダウンロード (5).png

What is equal principal repayment?

A method in which the highest priority is to "reduce the principal by a fixed amount every month" and the amount obtained by adding interest to that amount is used as the monthly repayment amount.

months = range(0, 35 * 12)
residual =  36000000
r = 0.012
fixed = 100000

hist_residual = []
hist_reduction = []
hist_interst = []
hist_month = []

for month in months:
    if residual < 0: break
    reduction = fixed 
    residual = residual - fixed
    
    hist_month.append(month)
    hist_residual.append(residual)
    hist_reduction.append(reduction)
    hist_interst.append(residual * r / 12.0)
    
fig, axs = plt.subplots(2, sharex=True)
axs[0].plot(hist_month, hist_residual)
axs[0].set_ylabel('residual')
axs[1].stackplot(hist_month, [hist_reduction, hist_interst], colors=['blue', 'pink'], labels=['residual', 'interest'])
axs[1].set_xlabel('month')
axs[1].legend()

ダウンロード (4).png

Impressions

I thought that miscommunication would be reduced if it was written in a calculation formula / programming language rather than expressed in letters because it would be transmitted without error.

Recommended Posts

What is equal repayment of principal and interest and equal repayment of principal and interest?
[Python] Python and security-① What is Python?
What kind of Kernel is this Kernel?
[Python] What is pandas Series and DataFrame?
What is the cause of the following error?
What is the difference between `pip` and` conda`?
What are you comparing with Python is and ==?
What is the difference between Unix and Linux?
What is namespace
What is copy.copy ()
What is Django? .. ..
What is POSIX?
What is Linux
What is klass?
What is SALOME?
What is Linux?
What is python
What is hyperopt?
What is Linux
What is pyvenv
What is __call__
What is Linux
What is Python
What is the difference between usleep, nanosleep and clock_nanosleep?
Indent behavior of json.dumps is different between python2 and python3
What is the true identity of Python's sort method "sort"? ??
Basics of Python learning ~ What is a string literal? ~
What is pip and how do you use it?
What is a recommend engine? Summary of the types
pca.components_ of sklearn is the correlation coefficient between the principal component and the feature, and is called the factor loading.
Bancor Protocol: What is Smart Token Innovation? "Solution of Coincidence of Wants" and "Reinventing the Wheel"