|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.imsl.finance.Finance
public class Finance
Collection of finance functions.
Field Summary | |
---|---|
static int |
AT_BEGINNING_OF_PERIOD
Flag used to indicate that payment is made at the beginning of each period. |
static int |
AT_END_OF_PERIOD
Flag used to indicate that payment is made at the end of each period. |
Method Summary | |
---|---|
static double |
cumipmt(double rate,
int nper,
double pv,
int start,
int end,
int when)
Returns the cumulative interest paid between two periods. |
static double |
cumprinc(double rate,
int nper,
double pv,
int start,
int end,
int when)
Returns the cumulative principal paid between two periods. |
static double |
db(double cost,
double salvage,
int life,
int period,
int month)
Returns the depreciation of an asset using the fixed-declining balance method. |
static double |
ddb(double cost,
double salvage,
int life,
int period,
double factor)
Returns the depreciation of an asset using the double-declining balance method. |
static double |
dollarde(double fractionalDollar,
int fraction)
Converts a fractional price to a decimal price. |
static double |
dollarfr(double decimalDollar,
int fraction)
Converts a decimal price to a fractional price. |
static double |
effect(double nominalRate,
int nper)
Returns the effective annual interest rate. |
static double |
fv(double rate,
int nper,
double pmt,
double pv,
int when)
Returns the future value of an investment. |
static double |
fvschedule(double principal,
double[] schedule)
Returns the future value of an initial principal taking into consideration a schedule of compound interest rates. |
static double |
ipmt(double rate,
int period,
int nper,
double pv,
double fv,
int when)
Returns the interest payment for an investment for a given period. |
static double |
irr(double[] pmt)
Returns the internal rate of return for a schedule of cash flows. |
static double |
irr(double[] pmt,
double guess)
Returns the internal rate of return for a schedule of cash flows. |
static double |
mirr(double[] value,
double financeRate,
double reinvestRate)
Returns the modified internal rate of return for a schedule of periodic cash flows. |
static double |
nominal(double effectiveRate,
int nper)
Returns the nominal annual interest rate. |
static double |
nper(double rate,
double pmt,
double pv,
double fv,
int when)
Returns the number of periods for an investment for which periodic, and constant payments are made and the interest rate is constant. |
static double |
npv(double rate,
double[] value)
Returns the net present value of a stream of equal periodic cash flows, which are subject to a given discount rate. |
static double |
pmt(double rate,
int nper,
double pv,
double fv,
int when)
Returns the periodic payment for an investment. |
static double |
ppmt(double rate,
int period,
int nper,
double pv,
double fv,
int when)
Returns the payment on the principal for a specified period. |
static double |
pv(double rate,
int nper,
double pmt,
double fv,
int when)
Returns the net present value of a stream of equal periodic cash flows, which are subject to a given discount rate. |
static double |
rate(int nper,
double pmt,
double pv,
double fv,
int when)
Returns the interest rate per period of an annuity. |
static double |
rate(int nper,
double pmt,
double pv,
double fv,
int when,
double guess)
Returns the interest rate per period of an annuity with an initial guess. |
static double |
sln(double cost,
double salvage,
int life)
Returns the depreciation of an asset using the straight line method. |
static double |
syd(double cost,
double salvage,
int life,
int per)
Returns the depreciation of an asset using the sum-of-years digits method. |
static double |
vdb(double cost,
double salvage,
int life,
int start,
int end,
double factor,
boolean no_sl)
Returns the depreciation of an asset for any given period using the variable-declining balance method. |
static double |
xirr(double[] pmt,
Date[] dates)
Returns the internal rate of return for a schedule of cash flows. |
static double |
xirr(double[] pmt,
Date[] dates,
double guess)
Returns the internal rate of return for a schedule of cash flows with a user supplied initial guess. |
static double |
xnpv(double rate,
double[] value,
Date[] dates)
Returns the present value for a schedule of cash flows. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int AT_BEGINNING_OF_PERIOD
public static final int AT_END_OF_PERIOD
Method Detail |
---|
public static double cumipmt(double rate, int nper, double pv, int start, int end, int when)
ipmt
for the th period.
rate
- a double
, the interest ratenper
- an int
, the total number of payment periodspv
- a double
, the present valuestart
- an int
, the first period in the caclulation.
Periods are numbered starting with one.end
- an int
, the last period in the calculationwhen
- an int
, the time in each period when the payment is made,
either AT_END_OF_PERIOD
or AT_BEGINNING_OF_PERIOD
double
, the cumulative interest paid between
the first period and the last periodpublic static double cumprinc(double rate, int nper, double pv, int start, int end, int when)
ppmt
for the th period.
rate
- a double
, the interest ratenper
- an int
, the total number of payment periodspv
- a double
, the present valuestart
- an int
, the first period in the calculation.
Periods are numbered starting with one.end
- an int
, the last period in the calculationwhen
- an int
, the time in each period when the payment is made,
either AT_END_OF_PERIOD
or AT_BEGINNING_OF_PERIOD
.
double
, the cumulative principal paid between the
first period and the last periodpublic static double db(double cost, double salvage, int life, int period, int month)
db
varies depending
on the specified value for the argument period, see table below.
If period = 1,
NOTE: is rounded to three decimal places.
cost
- a double
, the initial cost of the assetsalvage
- a double
, the salvage value of the assetlife
- an int
, the number of periods over which the asset
is being depreciatedperiod
- an int
, the period for which the depreciation is to be computedmonth
- an int
, the number of months in the first year
double
, the depreciation of an asset for a specified period
using the fixed-declining balance methodpublic static double ddb(double cost, double salvage, int life, int period, double factor)
cost
- a double
, the initial cost of the assetsalvage
- a double
, the salvage value of the assetlife
- an int
, the number of periods over which the asset
is being depreciatedperiod
- an int
, the periodfactor
- a double
, the rate at which the balance declines
double
, the depreciation of an asset for a specified periodpublic static double dollarde(double fractionalDollar, int fraction)
where is the integer part of , and is the integer part of .
fractionalDollar
- a double
, a fractional numberfraction
- an int
, the denominator
double
, the dollar price expressed as
a decimal numberpublic static double dollarfr(double decimalDollar, int fraction)
decimalDollar
- a double
, a decimal numberfraction
- a int
, the denominator
double
, a dollar price expressed
as a fractionpublic static double effect(double nominalRate, int nper)
nominalRate
- a double
, the nominal interest ratenper
- an int
, the number of compounding periods per year
double
, the effective annual interest ratepublic static double fv(double rate, int nper, double pmt, double pv, int when)
If ,
If ,
rate
- a double
, the interest ratenper
- an int
, the total number of payment periodspmt
- a double
, the payment made in each periodpv
- a double
, the present valuewhen
- an int
, the time in each period when the payment is made,
either AT_END_OF_PERIOD
or AT_BEGINNING_OF_PERIOD
double
, the future value of an investmentpublic static double fvschedule(double principal, double[] schedule)
schedule.length
.
principal
- a double
, the present valueschedule
- a double
array of interest rates to apply
double
, the future value of an initial principalpublic static double ipmt(double rate, int period, int nper, double pv, double fv, int when)
rate
- a double
, the interest rateperiod
- an int
, the payment periodnper
- an int
, the total number of periodspv
- a double
, the present valuefv
- a double
, the future valuewhen
- an int
, the time in each period when the payment is made,
either AT_END_OF_PERIOD
or AT_BEGINNING_OF_PERIOD
double
, the interest payment for a given period for
an investmentpublic static double irr(double[] pmt)
pmt.length
.
pmt
- a double
array which contains cash flow values
which occur at regular intervals
double
, the internal rate of returnpublic static double irr(double[] pmt, double guess)
pmt
- a double
array which contains cash flow values
which occur at regular intervalsguess
- a double
value which represents an initial guess
at the return value from this function
double
, the internal rate of returnpublic static double mirr(double[] value, double financeRate, double reinvestRate)
npv
for positive values in value
using reinvestRate
,
is calculated from npv
for
negative values in value
using financeRate
, and nper
= value.length
.
value
- a double
array of cash flowsfinanceRate
- a double
, the interest you pay
on the money you borrowreinvestRate
- a double
, the interest rate you
receive on the cash flows
double
, the modified internal
rate of returnpublic static double nominal(double effectiveRate, int nper)
effectiveRate
- a double
, the effective interest ratenper
- an int
, the number of compounding periods per year
double
, the nominal annual interest ratepublic static double nper(double rate, double pmt, double pv, double fv, int when)
If ,
If ,
rate
- a double
, the interest ratepmt
- a double
, the paymentpv
- a double
, the present valuefv
- a double
, the future valuewhen
- an int
, the time in each period when the payment is made,
either AT_END_OF_PERIOD
or AT_BEGINNING_OF_PERIOD
int
, the number of periods for an investmentpublic static double npv(double rate, double[] value)
value.length
.
rate
- a double
, the interest rate per period.
It must not be -1.value
- a double
array of equally-spaced cash flows
double
, the net present value of the investmentpublic static double pmt(double rate, int nper, double pv, double fv, int when)
If ,
If ,
rate
- a double
, the interest ratenper
- an int
, the total number of periodspv
- a double
, the present valuefv
- a double
, the future valuewhen
- an int
, the time in each period when the payment is made,
either AT_END_OF_PERIOD
or AT_BEGINNING_OF_PERIOD
double
, the interest payment for a given period for
an investmentpublic static double ppmt(double rate, int period, int nper, double pv, double fv, int when)
pmt
for the th period,
is calculated from ipmt
for the th period.
rate
- a double
, the interest rateperiod
- an int
, the payment periodnper
- an int
, the total number of periodspv
- a double
, the present valuefv
- a double
, the future valuewhen
- an int
, the time in each period when the payment is made,
either AT_END_OF_PERIOD
or AT_BEGINNING_OF_PERIOD
double
, the payment on the principal for a given periodpublic static double pv(double rate, int nper, double pmt, double fv, int when)
If ,
If ,
rate
- a double
, the interest rate per periodnper
- an int
, the number of periodspmt
- a double
, the payment made each periodfv
- a double
, the annuity's value after the last paymentwhen
- an int
, the time in each period when the payment is made,
either AT_END_OF_PERIOD
or AT_BEGINNING_OF_PERIOD
double
, the present value of the investmentpublic static double rate(int nper, double pmt, double pv, double fv, int when)
If ,
If ,
nper
- an int
, the number of periodspmt
- a double
, the payment made each periodpv
- a double
, the present valuefv
- a double
, the annuity's value after the last paymentwhen
- an int
, the time in each period when the payment is made,
either AT_END_OF_PERIOD
or AT_BEGINNING_OF_PERIOD
double
, the interest rate per period of an annuitypublic static double rate(int nper, double pmt, double pv, double fv, int when, double guess)
If ,
If ,
nper
- an int
, the number of periodspmt
- a double
, the payment made each periodpv
- a double
, the present valuefv
- a double
, the annuity's value after the last paymentwhen
- an int
, the time in each period when the payment is made,
either AT_END_OF_PERIOD
or AT_BEGINNING_OF_PERIOD
guess
- a double
value which represents an initial
guess at the interest rate per period of an annuity
double
, the interest rate per period of an annuitypublic static double sln(double cost, double salvage, int life)
cost
- a double
, the initial cost of the assetsalvage
- a double
, the salvage value of the assetlife
- an int
, the number of periods over which the asset
is being depreciated
double
, the straight line depreciation of an asset
for one periodpublic static double syd(double cost, double salvage, int life, int per)
cost
- a double
, the initial cost of the assetsalvage
- a double
, the salvage value of the assetlife
- an int
, the number of periods over which the asset
is being depreciatedper
- an int
, the period
double
, the sum-of-years digits depreciation of
an assetpublic static double vdb(double cost, double salvage, int life, int start, int end, double factor, boolean no_sl)
If ,
If ,
where is computed fromddb
for the th
period. = the first period where straight line
depreciation is greater than the depreciation using the double-declining
balance method.
cost
- a double
, the initial cost of the assetsalvage
- a double
, the salvage value of the assetlife
- an int
, the number of periods over which the asset
is being depreciatedstart
- an int
, the initial period for the calculationend
- an int
, the final period for the calculationfactor
- a double
, the rate at which the balance declinesno_sl
- a boolean
flag. If true, do not switch to straight-line
depreciation even when the depreciation is greater
than the declining balance calculation.
double
, the depreciation of the assetpublic static double xirr(double[] pmt, Date[] dates)
pmt.length
.
pmt
- a double
array which contains cash flow values
which correspond to a schedule of payments in datesdates
- a Date
array which contains a schedule of payment
dates
double
, the internal rate of returnpublic static double xirr(double[] pmt, Date[] dates, double guess)
pmt.length
.
pmt
- a double
array which contains cash flow values
which correspond to a schedule of payments in datesdates
- a Date
array which contains a schedule of payment
datesguess
- a double
value which represents an initial guess
at the return value from this function
double
, the internal rate of returnpublic static double xnpv(double rate, double[] value, Date[] dates)
value.length
rate
- a double
, the interest ratevalue
- a double
array containing the cash flowsdates
- a Date
array which contains a schedule of payment
dates
double
, the present value
|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |