# PAYMENT()

### PAYMENT()

Payments for a loan

Syntax

`       PAYMENT( nLoan, nInterest, nPeriods ) --> nPayment`

Arguments

<nLoan> amount of money you get from the bank

<nInterest> rate of interest per period, 1 == 100%

<nPeriods> period count

Returns

<nPayment> Periodical payment one has to make to pay the loan <nLoan> back

Description

PAYMENT() calculates the payment one has to make periodically to pay back a loan <nLoan> within <nPeriods> periods and for a rate of interest <nInterest> per period.

`debt in period 0 = <nLoan>`
`debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100)`
`debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100)`

etc…

debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100)

-> has to be 0, so <nPayment> = <nLoan>*(<nInterest>/100)/(1-(1+<nInterest>/100)ˆ(-n))

Examples

```       // You get a loan of 5172.56 at a interest rate of 0.5% per
// month (6% per year).
// For 5 years, you have to pay back every month

? payment( 5172.56, 0.005, 60 ) // --> 100.00```

Tests

```       payment( 5172.56, 0.0, 60 )   == 86.21
payment( 5172.56, 0.005, 60 ) == 100.00```

Compliance

PAYMENT() is compatible with CT3’s PAYMENT().

Platforms

All

Files

Source is finan.c, library is libct.

Seealso

PV(), FV(), PERIODS(), RATE()

# RATE()

### RATE()

Estimate rate of interest for a loan

Syntax

`      RATE( nLoan, nPayment, nPeriods ) --> nRate`

Arguments

<nLoan> amount of money you get from the bank <nPayment> amount of money you pay back per period <nPeriods> number of periods you pay the loan back

Returns

<nInterest> estimated rate of interest per period, 1 == 100%

Description

RATE() calculates the rate of interest per period for the given loan, payment per periods and number of periods. This is done with the same equation used in the PAYMENT() or PERIODS() function:

<nPayment> = <nLoan>*(<nInterest>/100)/(1-(1+<nInterest>/100)ˆ(-<nPeriods>))

However, this equation can not be solved for <nInterest> in a “closed” manner, i.e. <nInterest> = …, so that the result can only be estimated.

Examples

```      // You get a loan of 5172.56, pay 100 back every month for
// 5 years (60 months). The effective interest rate per
// period (=month) is

? rate( 5172.56, 100, 60 ) // --> 0.005```

Tests

```      rate( 5172.56, 100, 60.0 ) == 0.005
rate( 6000.0, 100, 60.0 ) == 0.0```

Compliance

RATE() is compatible with CT3’s RATE().

Platforms

All

Files

Source is finan.c, library is libct.

Seealso

PV(), FV(), PAYMENT(), PERIODS()

# PV()

### PV()

Present value of a loan

Syntax

`      PV( nPayment, nInterest, nPeriods ) --> nPresentValue`

Arguments

<nPayment> amount of money paid back per period <nInterest> rate of interest per period, 1 == 100%

<nPeriods> period count

Returns

<nPresentValue> Present value of a loan when one is paying back <nDeposit> per period at a rate of interest of <nInterest> per period

Description

PV() calculates the present value of a loan that is paid back in <nPeriods> payments of <nPayment> (Dollars, Euros, Yens, …)
while the rate of interest is <nInterest> per period:
debt in period 0 = <nPresentValue>
debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100)
debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100) etc…
debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100)

-> has to be 0, so

<nPresentValue> = <nPayment>*(1-(1+<nInterest>/100)ˆ(-n)) / (<nInterest>/100)

Examples

```      // You can afford to pay back 100 Dollars per month for 5 years
// at a interest rate of 0.5% per month (6% per year), so instead
// of 6000 Dollars (the amount you will pay back) the bank will pay
// you

? pv( 100, 0.005, 60 ) // --> 5172.56```

Tests

```      pv( 100, 0.0, 60 )   == 6000.0
pv( 100, 0.005, 60 ) == 5172.56```

Compliance

PV() is compatible with CT3’s PV().

Platforms

All

Files

Source is finan.c, library is libct.

Seealso

FV(), PAYMENT(), PERIODS(), RATE()

# Periods()

### Periods()

Number of Periods for a loan

Syntax

`      Periods( nLoan, nPayment, nInterest ) --> nPeriods`

Arguments

<nLoan> amount of money you get from the bank <nPayment> amount of money you pay back per period <nInterest> rate of interest per period, 1 == 100%

Returns

<nPeriods> number of Periods you need to pay the loan back

Description

Periods() calculates the number of Periods one needs to pay back a loan of <nLoan> with periodical payments of <nPayment> and for a rate of interest <nInterest> per period.

debt in period 0 = <nLoan>
debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100)
debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100) etc…
debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100)

-> has to be 0, so

<nPeriods> = -log(1-<nLoan>*(<nInterest>/100)/<nPayment>)/log(1+<nInterest>/100))

Note, however that in the case of nPayment <= <nLoan>*(<nInterest>/100), one would need infinite time to pay the loan back. The functions does then return -1.

Examples

```      // You get a loan of 5172.56 at a interest rate of 0.5% per
// month (6% per year).
// You can afford to pay 100 back every month, so you need

? Periods( 5172.56, 100, 0.005 ) // --> 60.0

// months to cancel the loan.```

Tests

```      Periods( 5172.56, 100, 0.005 ) == 60.0
Periods( 5172.56, 100, 0.0 ) == 51.7256```

Compliance

Periods() is compatible with CT3’s Periods().

Platforms

All

Files

Source is finan.c, library is libct.

Seealso

PV(), FV(), PAYMENT(), RATE()

# Harbour Accounting Functions

### Accounting Functions

 FV Future value of a capital Payment Payments for a loan Periods Number of Periods for a loan PV Present value of a loan Rate Estimate rate of interest for a loan

# CT_FV

``` FV()
Computes future value of capital
------------------------------------------------------------------------------
Syntax

FV(<nInstall>,<nInterestRate>,<nNumberofPayments>)
--> nCapital

Arguments

<nInstall>  Designates the installment amount to pay for the period.

<nInterestRate>  Designates the interest rate calculated for the
payment period.  1 corresponds to 100%.

<nNumberofPayments>  Designates the number of payments.

Returns

FV() returns the future capital value of the total deposits, plus the
interest generated.

Description

FUTURE VALUE
FV() returns the capital available after the <nNumberofPayments> total
installments at <nInstall> payment, at an <nInterestRate> interest
charge for the period.

Example

What amount would you save, if you pay \$150.00 per month for 3 years
into a fund that pays an annual interest rate of 6%?

nRate  :  0.06/12         // Monthly interest rate
? FV(150, nRate, 36)      // Result: 5900.42```