【问题标题】:How to find interest rate with payments如何通过付款找到利率
【发布时间】:2013-11-15 05:00:34
【问题描述】:

我需要一个公式来计算涉及付款的利率,其他相关公式如下:

FV = (PMT * k / ip) - Math.pow((1 + ip), N) * (PV + PMT * k / ip);

PV = (PMT * k / ip - FV) * 1 / Math.pow(1 + ip, N) - PMT * k / ip;

PMT = (PV + ((PV+FV)/(Math.pow((1+ip),N)-1))) * ((-ip)/k);

ip = ????

Where:

PV = Present Value

ip = Interest Rate per period

N = Number of periods

PMT = Payment

k = 1 if payment is made at the end of the period; 1 + ip if made at the beginning of the period

FV = Future Value

有人在Calculate interest rate in Java (TVM) 上问过同样的问题,但仍然找不到正确答案。

建议的解决方案是将所有已知变量代入下面的公式,然后为 ip 选择一系列值,直到表达式等于 0:

0 = (PV * Math.pow(1 + ip, N)) + ((PMT * k) * (Math.pow(1 + ip, N) - 1) / ip) + FV

如何创建一个函数来进行迭代,或者有什么简单的公式可以解决这个问题?

【问题讨论】:

  • 我不确定您的公式是否正确。你从哪里弄来的?无论如何,对于ip,这些方程无法明确求解。一种方法是对您想要的任何方程使用牛顿法。
  • 这些公式经测试正确,来自getobjects.com/Components/Finance/TVM/formulas.html

标签: java math


【解决方案1】:

ip 的公式无法求解;您无法使用您选择的根查找器。 Newton's Method 如下:

static double implicit(double PV, double ip, double N, double PMT, double k, double FV) {
    return PV * Math.pow(1+ip,N)
        + PMT * k * (Math.pow(1+ip,N)-1) / ip + FV;
}

static double dImplicit_dIp(double PV, double ip, double N, double PMT, double k, double FV) {
    return PV * N * Math.pow(1+ip,N-1)
        + PMT * k * ( ip * N * Math.pow(1+ip,N-1) - Math.pow(1+ip,N) + 1) / (ip*ip);
}

static double getIp(double PV, double N, double PMT, double k, double FV) {
    double ip = .1;
    double ipLast;
    do {
        ipLast = ip;
        ip -= implicit(PV,ip,N,PMT,k,PV)/dImplicit_dIp(PV,ip,N,PMT,k,PV);
    } while ( Math.abs(ip-ipLast) > .00001 );
    return ip;
}

【讨论】:

    猜你喜欢
    • 2014-04-12
    • 2015-07-20
    • 2016-09-03
    • 1970-01-01
    • 2016-03-13
    • 2013-12-03
    • 1970-01-01
    • 2013-02-15
    • 2013-01-24
    相关资源
    最近更新 更多