/* $DOC$ $NAME$ FV() $CATEGORY$ CT3 math functions $ONELINER$ Future value of a capital $SYNTAX$ FV( nDeposit, nInterest, nPeriods ) --> nFutureValue $ARGUMENTS$ amount of money invested per period rate of interest per period, 1 == 100% period count $RETURNS$ Total value of the capital after of paying and interest being paid every period and added to the capital (resulting in compound interest) $DESCRIPTION$ FV() calculates the value of a capital after periods. Starting with a value of 0, every period, (Dollars, Euros, Yens, ...) and an interest of for the current capital are added for the capital (=Percent/100). Thus, one gets the non-linear effects of compound interests: value in period 0 = 0 value in period 1 = ((value in period 0)*(1+/100)) + value in period 2 = ((value in period 1)*(1+/100)) + etc.... value in period = ((value in period -1)*(1+/100))< + = * sum from i=0 to -1 over (1+/100)^i = * ((1+/100)^n-1) / (/100) $EXAMPLES$ // Payment of 1000 per year for 10 years at a interest rate // of 5 per cent per year ? FV( 1000, 0.05, 10 ) // --> 12577.893 $STATUS$ Ready $COMPLIANCE$ FV() is compatible with CT3's FV(). $PLATFORMS$ All $FILES$ Library is hbct. $SEEALSO$ PV(), Payment(), Periods(), Rate() $END$ */ /* $DOC$ $NAME$ PV() $CATEGORY$ CT3 math functions $ONELINER$ Present value of a loan $SYNTAX$ PV( nPayment, nInterest, nPeriods ) --> nPresentValue $ARGUMENTS$ amount of money paid back per period rate of interest per period, 1 == 100% period count $RETURNS$ Present value of a loan when one is paying back per period at a rate of interest of per period $DESCRIPTION$ PV() calculates the present value of a loan that is paid back in payments of (Dollars, Euros, Yens,...) while the rate of interest is per period: debt in period 0 = debt in period 1 = ((debt in period 0)-)*(1+/100) debt in period 2 = ((debt in period 1)-)*(1+/100) etc... debt in period = ((debt in period -1)-)*(1+/100) -> has to be 0, so = *(1-(1+/100)^(-n))/(/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 $STATUS$ Ready $COMPLIANCE$ PV() is compatible with CT3's PV(). $PLATFORMS$ All $FILES$ Library is hbct. $SEEALSO$ FV(), Payment(), Periods(), Rate() $END$ */ /* $DOC$ $NAME$ Payment() $CATEGORY$ CT3 math functions $ONELINER$ Payments for a loan $SYNTAX$ Payment( nLoan, nInterest, nPeriods ) --> nPayment $ARGUMENTS$ amount of money you get from the bank rate of interest per period, 1 == 100% period count $RETURNS$ Periodical payment one has to make to pay the loan back $DESCRIPTION$ Payment() calculates the payment one has to make periodically to pay back a loan within periods and for a rate of interest per period. debt in period 0 = debt in period 1 = ((debt in period 0)-)*(1+/100) debt in period 2 = ((debt in period 1)-)*(1+/100) etc... debt in period = ((debt in period -1)-)*(1+/100) -> has to be 0, so = *(/100)/(1-(1+/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 $STATUS$ Ready $COMPLIANCE$ Payment() is compatible with CT3's Payment(). $PLATFORMS$ All $FILES$ Library is hbct. $SEEALSO$ PV(), FV(), Periods(), Rate() $END$ */ /* $DOC$ $NAME$ Periods() $CATEGORY$ CT3 math functions $ONELINER$ Number of periods for a loan $SYNTAX$ Periods( nLoan, nPayment, nInterest ) --> nPeriods $ARGUMENTS$ amount of money you get from the bank amount of money you pay back per period rate of interest per period, 1 == 100% $RETURNS$ 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 with periodical payments of and for a rate of interest per period. debt in period 0 = debt in period 1 = ((debt in period 0)-)*(1+/100) debt in period 2 = ((debt in period 1)-)*(1+/100) etc... debt in period = ((debt in period -1)-)*(1+/100) -> has to be 0, so = -Log(1-*(/100)/)/Log(1+/100)) Note, however that in the case of nPayment <= *(/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. $STATUS$ Ready $COMPLIANCE$ Periods() is compatible with CT3's Periods(). $PLATFORMS$ All $FILES$ Library is hbct. $SEEALSO$ PV(), FV(), Payment(), Rate() $END$ */ /* $DOC$ $NAME$ Rate() $CATEGORY$ CT3 math functions $ONELINER$ Estimate rate of interest for a loan $SYNTAX$ Rate( nLoan, nPayment, nPeriods ) --> nRate $ARGUMENTS$ amount of money you get from the bank amount of money you pay back per period number of periods you pay the loan back $RETURNS$ 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: = *(/100)/(1-(1+/100)^(-)) However, this equation can not be solved for in a "closed" manner, i.e. = ..., 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 $STATUS$ Ready $COMPLIANCE$ Rate() is compatible with CT3's Rate(). $PLATFORMS$ All $FILES$ Library is hbct. $SEEALSO$ PV(), FV(), Payment(), Periods() $END$ */