Example: Interest Rate
Someone obtains a $20,000 loan to buy a car. They make $350 a month payments for 70 months. Here, the interest rate of the loan is computed.
using System;
using Imsl.Finance;
public class rateEx1
{
public static void Main(String[] args)
{
int nper = 70;
double pmt = - 350.0;
double pv = 20000;
double fv = 0.0;
double rate = 12.0 * Finance.Rate(nper, pmt, pv, fv,
Finance.Period.AtBeginning);
Console.Out.WriteLine("The computed interest rate on the loan "
+ "is " + rate.ToString("P"));
}
}
Output
The computed interest rate on the loan is 7.35 %
Link to C# source.