/**
* 利息计算:
* 借款 12000,一年还,名义月利息是 1.2%,名义年利息是 14.4%。
* 即,每个月还款 1144
* 12000 * 1.144 /12 = 1000 * 1.144 = 1144。
* 实际月利率是多少?
* @author zch
* @date Nov 28, 2011
*
*/
public class Lxjs {
private static double test01(double x)
{
/**
* y1 * (1+x) = 1144
* y2 * (1+x)^2 = 1144
* y3 * (1+x)^3 = 1144
* y4 * (1+x)^4 = 1144
* y5 * (1+x)^5 = 1144
* y6 * (1+x)^6 = 1144
* y7 * (1+x)^7 = 1144
* y8 * (1+x)^8 = 1144
* y9 * (1+x)^9 = 1144
* y10* (1+x)^10 = 1144
* y11* (1+x)^11 = 1144
* y12* (1+x)^12 = 1144
* y1+...+y12 = 12000
*/
double lxs[] = new double[12]; //利率
double bjs[] = new double[12]; //本金
double sum = 0;
for(int i=0; i<12; i++)
{
lxs[i] = Math.pow(1+x, i+1);
bjs[i] = 1144 / lxs[i];
sum +=bjs[i];
System.out.println( (i+1) + ":\t" +lxs[i] + ":\t" +bjs[i]);
}
return sum;
}
/**
* @param args
*/
public static void main(String[] args) {
int i = 2100;
for(; i<2200; i++)
{
System.out.println(i);
double sum = test01(i/100000d);
System.out.println(sum);
if(sum<12000)
{
break;
}
}
}
}
2132
1: 1.02132: 1120.1190616065485
2: 1.0430945424: 1096.7366365160267
3: 1.065333318043968: 1073.8423182900822
4: 1.0880462243846654: 1051.4259177242022
5: 1.1112433698885464: 1029.4774583129697
6: 1.1349350785345704: 1007.9871718099807
7: 1.1591318944089273: 986.9454938804497
8: 1.1838445863977256: 966.3430598445636
9: 1.2090841529797252: 946.1707005096969
10: 1.234861827121253: 926.4194380896259
11: 1.261189081275478: 907.0804822089316
12: 1.2880776324882712: 888.1452259908076
12000.692964783886
2133
1: 1.02133: 1120.1080943475663
2: 1.0431149689: 1096.7151599850845
3: 1.0653646111866373: 1073.8107761302265
4: 1.0880888383432483: 1051.3847396338367
5: 1.11129777326511: 1029.4270604347632
6: 1.1350017547688547: 1007.927957109615
7: 1.1592113421980745: 986.8778525154602
8: 1.1839373201271595: 966.2673695235234
9: 1.2091907031654718: 946.0873268419838
10: 1.2349827408639915: 926.3287349260119
11: 1.2613249227266206: 906.9827919732229
12: 1.2882289833283793: 888.0408800027641
1
1999.958743424058