Example: Cumulative Principal Example

The amount of principal paid in the first year of a 30 year fixed rate mortgage is computed. The amount financed is $200,000 at an interest rate of 7.25% for 30 years.
using System;
using Imsl.Finance;

public class cumprincEx1
{
    public static void  Main(String[] args)
    {
        double rate = 0.0725 / 12;
        int periods = 12 * 30;
        double pv = 200000;
        int start = 1;
        int end = 12;
        double total = Finance.Cumprinc(rate, periods, pv, start, end,
                                        Finance.Period.AtEnd);
        Console.Out.WriteLine("First year principal = " + 
                               total.ToString("C"));
    }
}

Output

First year principal = ($1,935.71)

Link to C# source.