習題8.9

等我刷把宗师發表於2024-11-19
import numpy as np
import pandas as pd
import sympy as sp
sp.init_printing(use_latex=True)
from scipy.integrate import odeint
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['Times New Roman + SimSun + WFM Sans SC']
plt.rcParams['mathtext.fontset']='stix'
# Times New Roman + SimSun + WFM Sans SC
# simsum宋體, times new roman -*, simhei黑體, kaiti楷體,
# dengxian等線, fangsong仿宋, Microsoft Yahei微軟雅黑
plt.rcParams['axes.unicode_minus']=False
plt.rcParams['figure.dpi'] = 200
# plt.rcParams['figure.figsize'] = [4, 3]
# plt.rcParams['font.size'] = 12
plt.rcParams['xtick.direction']='in'
plt.rcParams['ytick.direction']='in'
Q = 60e4 - 20e4         # 貸款總額
r = 0.36/100    # 月利率
N = 30*12         # 總月數 (還款期限)
x = np.round((1+r)**N*Q*r / ((1+r)**N - 1), 2)
print("每月還款:", x)
print("總還款額:", x*N)
print("我的學號是: 31")