首页 文章

如何通过付款查找利率

提问于
浏览
2

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

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 = (PV * Math.pow(1 + ip, N)) + ((PMT * k) * (Math.pow(1 + ip, N) - 1) / ip) + FV

如何创建一个函数来进行迭代,还是有任何简单的公式来解决这个问题?

1 回答

  • 0

    ip 无法解决公式;你使用你选择的root查找器卡住了 . 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;
    }
    

相关问题