一、IRR计算的原理:
内部收益率(Internal Rate of Return (IRR)),就是资金流入现值总额与资金流出现值总额相等、净现值等于零时的折现率。
用公式 标识:-200+[30/(1+IRR)+30/(1+IRR)^2+....+30/(1+IRR)^10]=0。多次方程求解。
在计算机界求解高次方程的做法通常是利用牛顿插值法(Newton-Raphson)来实现,也有翻译牛顿迭代的。
二、关于牛顿迭代:
设r是 的根,选取
作为r的初始近似值,过点
做曲线
的切线L,L的方程为
,求出L与x轴交点的横坐标
![](https://gss3.bdstatic.com/-Po3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D113/sign=4759ab76e9f81a4c2232e8c8e42b6029/adaf2edda3cc7cd9c67a2ddb3b01213fb80e9158.jpg)
![](https://gss2.bdstatic.com/-fo3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D71/sign=43308263f1deb48fff69a3dff11f38a8/c995d143ad4bd113cd3aaf3058afa40f4bfb0538.jpg)
![](https://gss3.bdstatic.com/7Po3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D59/sign=a638fa186259252da7171d0d359bf9a9/810a19d8bc3eb1354c3bafb9a41ea8d3fd1f4437.jpg)
![](https://gss2.bdstatic.com/9fo3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D113/sign=265ea26696eef01f49141cc4d3ff99e0/71cf3bc79f3df8dc43d19493cf11728b461028c7.jpg)
![](https://gss2.bdstatic.com/-fo3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D15/sign=4e7e68110bf79052eb1f433b0df3edbc/5d6034a85edf8db1a5c967660b23dd54574e74c8.jpg)
![](https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D129/sign=763132a7087b020808c93be35bd9f25f/6a63f6246b600c339f73c4ca184c510fd9f9a1ad.jpg)
![](https://gss2.bdstatic.com/-fo3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D33/sign=670fbe609a22720e7fcee4f97acbeb58/5d6034a85edf8db1a5eb67660b23dd54574e74ee.jpg)
三、Java的实现方式:
import java.math.BigDecimal; public class IRRUtilMath2 { public static double irr(double[] income) {