Delphi Financial and Statistical functions

Posted by DelphiLand Team

In Reply to: Financial functions posted by John

: I have found several scientific and engineering function libraries for Delphi but I have been unable to find one for financial functions i.e. NPV, IRR, Depreciation etc?

: Anyone got any information where I can find?

If you haven't heard of Delphi's Math unit, you're not alone. The info is kind of buried in the Delphi documentation, and few programmers ever use it knowingly. MATH was included starting from the Delphi 2.0 Developer version, but later most of it became available even in Delphi's Personal versions.

Here is a partial alphabetical list of financial, statistical and related functions available in Delphi 6 and later versions:

DoubleDecliningBalance: calculates the depreciation of an asset using the double-declining balance method.

FutureValue: calculates the future value of an investment.

InterestPayment: calculates the interest portion of a loan payment.

InterestRate: returns the interest rate required to increase PresentValue to FutureValue.

InternalRateOfReturn: calculates the internal rate of return for an investment.

Ldexp: calculates X * (2**P)

LnXP1: returns the natural log of (X+1)

Log10: calculates log base 10.

Log2: calculates log base 2.

LogN: calculates the log of X for a specified base.

Mean: returns the average of all values in an array.

MeanAndStdDev: calculates the mean and standard deviation of array elements.

MomentSkewKurtosis: calculates the mean, variance, skew, and kurtosis.

NumberOfPeriods: returns the number of payment periods for an investment.

Payment: calculates a fully amortized payment.

PeriodPayment: returns the principal amount from a full payment.

PopnStdDev: calculates the population standard deviation.

PopnVariance: calculates the population variance.

Power: raises Base to any power.

PresentValue: calculates the present value of an investment.

SLNDepreciation: returns the straight-line depreciation allowance of an asset.

StdDev: returns the sample standard deviation for elements in an array.

Sum: returns the sum of the elements in an array.

SumOfSquares: returns the sum of the squared values from a data array.

SumsAndSquares: returns the sum of the values and the sum of the squared values in an array.

SYDDepreciation: calculates depreciation for an asset.

TotalVariance: returns the statistical variance from an array of values.

Variance: calculates statistical sample variance from an array of data.

Not all of these functions are available in earlier versions of Delphi: Delphi 5 has less functions than Delphi 6, Delphi 4 has less than 5,... For a complete list of available Delphi Math functions, see your Delphi's Help Files.

As you noted, specialized Math libaries with additional functions are available for Delphi. Most of them are commercial versions, but also some freeware libs can be found on the Internet.

Jeff,
DelphiLand Team