当前位置:网站首页>Interest rate in installment payment
Interest rate in installment payment
2022-07-23 10:38:00 【choumin】
Recently I bought a commodity with a loan , Before the loan, the merchant said that the annual interest rate was only 3.11%, It looks really low , But it was later found that due to the staging , The comprehensive annual interest rate is not low .
This product is divided into 36 period , Pay an equal amount in each installment , namely : Suppose the loan amount is A A A element , Each installment shall be repaid :
A + A ∗ 0.0311 ∗ 3 36 \frac{A+A*0.0311*3}{36} 36A+A∗0.0311∗3 What is the comprehensive annual interest rate ? Now try to calculate .
hypothesis , The loan amount is A A A element , The comprehensive annual interest rate is x x x, The first i i i The amount of repayment is : y y y( Equal amount of each period ), The principal is : w ( i ) w(i) w(i), The interest is : v ( i ) v(i) v(i), Then there are the following equations :
y = A + A ∗ 0.0311 ∗ 3 36 (1) \tag{1} y = \frac{A+A*0.0311*3}{36} y=36A+A∗0.0311∗3(1)
y = w ( i ) + v ( i ) (2) \tag{2} y = w(i) + v(i) y=w(i)+v(i)(2)
v ( i ) = ( A − ∑ j = 1 i − 1 w ( j ) ) ∗ x 12 (3) \tag{3} v(i) = (A-\sum_{j=1}^{i-1}w(j)) * \frac{x}{12} v(i)=(A−j=1∑i−1w(j))∗12x(3)
∑ i = 1 36 v ( i ) = A ∗ 0.0311 ∗ 3 (4) \tag{4}\sum_{i=1}^{36}v(i) = A * 0.0311 * 3 i=1∑36v(i)=A∗0.0311∗3(4)
The above is known 4 Equation , seek : x x x ?
Poor math skills , Although the formula is listed , But I don't know how to calculate . You can only write the following program manually ( 3 ) (3) (3) Type in the x x x, The basic principle is : Suppose the comprehensive annual interest rate is 0.0311( The annual interest rate mentioned by the merchant ) To 0.1( It is estimated that it will not exceed 10%) Between , Then you can go from [0.0311, 0.1] Select evenly 1000 A little bit , From here 1000 Choose one of the points to make ( 4 ) (4) (4) The error of the left and right ends of the formula is the smallest x x x value . Carefully observe the above formulas , It can be found in ( 4 ) (4) (4) After expansion , Both sides of the equation can simultaneously reduce the loan principal , in other words , The loan principal has nothing to do with the comprehensive annual interest rate , The following code assumes that the loan principal is 100000. The code is as follows :
#include <stdio.h>
#define A 100000
#define CANDIDATE_MAX_NUM 1000
struct candidate {
double rate;
double result;
double diff;
};
double abs_double(double num)
{
return num >= 0 ? num : -num;
}
double v_sum(double rate)
{
double y = (A + A * 0.0311 * 3) / 36;
double vi, wi, w_sum = 0, _v_sum = 0;
int i = 0;
for (i = 1; i <= 36; ++i) {
vi = (A - w_sum) * rate * 1 / 12;
wi = y - vi;
w_sum += wi;
_v_sum += vi;
}
return _v_sum;
}
void calc(void)
{
double min = 0.0311;
double max = 0.1000;
double step = (max - min) / CANDIDATE_MAX_NUM;
double r = min;
struct candidate cand = {
0, 0, 0};
double target = A * 0.0311 * 3;
double result, diff;
int i = 0;
for (i = 0; i < CANDIDATE_MAX_NUM; ++i) {
result = v_sum(r);
diff = abs_double(result - target);
if (i == 0 || diff < cand.diff) {
cand.rate = r;
cand.result = result;
cand.diff = diff;
}
r += step;
}
printf("rate = %lf, result = %lf, target = %lf, diff = %lf\n",
cand.rate, cand.result, target, cand.diff);
}
int main(void)
{
calc();
return 0;
}
The program runs as follows :
[[email protected]]$ ./main
rate = 0.058867, result = 9334.592459, target = 9330.000000, diff = 4.592459
It can be seen from the above running results , The calculated comprehensive annual interest rate x x x by 5.88%, The annual interest rate is much higher than the business said , Like to see , The comprehensive annual interest rate of installment payment is not low .
边栏推荐
- No routines, no traps, no advertisements | are you sure you don't need this free instant messaging software?
- Summary of topics related to strings
- 第四篇章:运行时数据区——共享空间
- 添加信任列表
- 《Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks》论文阅读
- 【学习笔记】AGC022
- CV (3)- CNNs
- The safe distance between you and personal information leakage may be decided by a laptop!
- 【Qt5.12】Qt5.12安装教程
- Advantages and disadvantages of RDB and AOF
猜你喜欢
随机推荐
22、wpf之Combobox使用小记
New file / filter / folder in VS
32.< tag-数组和位运算>补充: lt.剑指 Offer 56 - I. 数组中数字出现的次数
Redis replication cluster setup
CLion + MinGW64配置C语言开发环境 Visual Studio安装
阿里云如何将一个域名解析到另一个域名上
Rapid SQL all platforms high performance SQL code
百度沈抖:聚焦场景深耕行业,为企业数字化带来实际成效
SAP batch import template (WBS batch import as an example)
The safe distance between you and personal information leakage may be decided by a laptop!
Sequence model (III) - sequence model and attention mechanism
Chrome selenium uses the default profile without emptying it every time
常见神经网络参数量与计算量
添加信任列表
RTC 性能自动化工具在内存优化场景下的实践
Underlying mechanism of pointer
How switch statements work
【车联网原型系统|二】数据库+应用层协议设计
redis伪集群一键部署脚本---亲测可用
performance介绍








