Delphi/Kylix Math Functions

Engineering Mathematics


Hyperbolic Functions
Special Functions
Complex Math and Functions
Linear Algebra, Matrices, Eigenvalues, Eigenvectors
Digital Signal Processing, Fourier Transforms, FFTs
Ordinary and Partial Differential Equations
Sources Key

Hyperbolic Functions

Function Name Description Source(s)
arccosh Function ArcCosh(X: Extended): Extended;
Input: X >= 1
math, TPmath1(fmath),
Turbo (p. 143), AugMath
ArcCotH function ArcCotH(
const X: Extended): Extended;
Kylix math
ArcCscH function ArcCscH(
const X: Extended): Extended; 
Kylix math
ArcSecH function ArcSecH(
const X: Extended): Extended;
Kylix math
arcsinh Function ArcSinh(X: Extended): Extended; math, TPmath1(fmath),
Turbo (p. 143), AugMath
arctanh Function ArcTanh(X: Extended): Extended;
Input: |X| <= 1
math, TPmath1(fmath), AugMath
cosh Function Cosh(X: Extended): Extended;
cosh(x) = [exp(x) + exp(-x)]/2
math, TPmath1(fmath),
Turbo (p. 143), AugMath
coth coth = 1/tanh

function CotH(const X: Extended): Extended; 

Kylix math,
csch csch = 1/sinh

function CscH(
const X: Extended): Extended; 

Kylix math, AugMath


hypberbolic functions and inverse functions ESBMaths
fch, fsh, fth cosh, sinh, tanh mathlib2(hyper387)
sech 1/cosh

function SecH(
const X: Extended): Extended; 

Kylix math, AugMath
sinh Function Sinh(X: Extended): Extended;

sinh(x) = [exp(x) - exp(-x)]/2
math, TPmath1(fmath),
Turbo (p. 142), AugMath
tanh Function Tanh(X: Extended): Extended;

tanh(x) = sinh(x)/cosh(x)
math, TPmath1(fmath),
Turbo (p. 143), AugMath


Special Functions

Numerical Methods in Pascal page

Function Name Description Source(s)
modified Bessel function I of integer order
modified Bessel function I0
modified Bessel function I1
Bessel function J of integer order
Bessel function J0
Bessel function J1
bessj(x,n) Bessel function of the first kind mathe
modified Bessel function K of integer order
modified Bessel function K0
modified Bessel function K1
modified Bessel function Y of integer order
modified Bessel function Y0
modified Bessel function Y1
Beta beta function TPmath1(fmath),
cel complete elliptic integral recipes(cel)
error function,
erfcc error function,
complementary, concise
gamma gamma function TPmath1(fmath),
mathe, Turbo (p. 142)
gamma function

gamma(z + 1) = z * gamma(z) = z!

incomplete gamma function (gammp)
incomplete, complement (gammq)
logarithm of gamma function (gammln)

Gradient & Hessian Gradient and Hessian of a function of several variables. TPmath2 (hessian)
IBeta incomplete beta function TPmath1(fmath)
IGamma incomplete gamma function TPmath1(fmath)
JGamma complemement of IGamma TPmath1(fmath)
LnGamma Log(| Gamma(X) |) TPmath1(fmath),
plgndr Legendre polynomials, associated (spherical harmonics) recipes
SgnGamma Sign of gamma function TPmath1(fmath)
sncndn Jacobian elliptic functions recipes


Complex Math and Functions

Numerical Methods in Pascal page 

Complex Variables


Complex Roots in C/C++ 

Function Name(s) Description Source(s)
Complex Arithmetic Overview   Stockton
Complex Functions CConvert, CSet, CStr, CAdd, CDiv, CMult, CSub, CNeg, CLn, CExp, CPwr, CCos, CSin, CTan, CSec, CCsc, CCot, CCosh, CSinh, CTanh, CSech, CCsch, CCoth, CAbs, CAbsSqr, CIntPower, CRealPower, CPower, CConjugate, CSqrt, CRoot, CI0, CJ0, CLnGamma, CGama, CDeFuzz, DeFuzz, SetFuzz, FixAngle efg'sComplexMathLibrary
Complex Functions: cadd, csub, cmul, cdiv, cneg, ccong, crcp, ciz, c_iz, czero, cmod, cequal, carg, cexp, cln, csqrt, ccos, csin, ctg, carc_cos, carc_sin, carc_tg, cch, csh, cth, carg_ch, carg_sh, carg_th mathlib2(pcomplex)
Complex Functions RP, IP, Cmplx, PolarCmplx, cabs, arg, cc, ca, cs, cm, rc, cd, cr, PrSqrt, cExp, cLn, csin, ccos, ctan, ccosh, csinh, ctanh EZmath

Another Complex Library
Complex Library   UDDF MATH
Complex Unit  
C_LU_Decomp LU decomposition TPmath1 (matcomp)
C_LU_Solve Solves system of equations TPmath1 (matcomp)
Delphi 6 Complex functions General: VarComplexCreate (with overloads), VarComplex, VarIsComplex, VarAsComplex, VarComplexSimplify, VarComplexAbsSqr, VarComplexAbs, VarComplexAngle, VarComplexConjugate, VarComplexInverse, VarComplexExp, VarComplexLn, VarComplexSqr, VarComplexSqrt, VarComplexTimesPosI, VarComplexTimesNegI, VarComplexPower 

Trig/Hyperbolic: VarComplexCos, VarComplexSin, VarComplexTan, VarComplexCot, VarComplexSec, VarComplexCsc, VarComplexArcCos, VarComplexArcSin, VarComplexArcTan, VarComplexArcCot, VarComplexArcSec, VarComplexArcCsc, VarComplexCosH, VarComplexSinH, VarComplexTanH, VarComplexCotH, VarComplexSecH, VarComplexCscH, VarComplexArcCosH, VarComplexArcSinH, VarComplexArcTanH, VarComplexArcCotH, VarComplexArcSecH, VarComplexArcCscH 

Conversion: VarComplexToPolar, VarComplexFromPolar Variables: ComplexNumberSymbol, ComplexNumberSymbolBeforeImaginary

VarCmplx (D6).  
Fnd the source in ..\Delphi6\Source\Rtl\Common)
Intel's Digital Signal Processing  Library (ISPL) See Digital Signal Processing. ISPL
MMEMatrix Very easy and fast complex matrix class.
Plotting Complex Functions  


Linear Algebra, Matrices, Eigenvalues, Eigenvectors

Numerical Methods in Pascal page

Function Name Description Source(s)
Add_Matrix add matrices A and B to give matrix C Turbo (p. 146)
balanc balance a nonsymmetric matrix recipes
Determinant and Matrix Inverse   TPMath2 (DetInv)
Eigenvectors and Eigenvalues Symmetric Matrix,
General Square Matrix,
Real Eigenvalue & EigenMatrix
eigsrt eigenvectors, sorts into order by eigenvalue recipes
elmhes reduce a general matrix to Hessenberg form recipes
Extentia Exentia is an open-source library for Delphi designed to perform computations on vectors of 32-bit floating point data elements using the Intel SSE, AMD 3D Now! and Intel x87 instruction sets. 

Dr. Chris Rorden created a  very basic project based on this software.  It uses QueryPerformanceCounter to measure the performance benefit for using SIMD calls.

Gauss Elimination   
Gaussian Reduction  
GaussJ Gauss-Jordan matrix inversion

Download Turbo Pascal 5.5from the Borland Community Museum:,
and look for the HILB.PAS file.

mathe, recipes(gaussj)


hqr eigenvalues of a Hessenberg matrix recipes
Invert_Matrix add matrices A and B to give matrix C Turbo (p. 147-148)
Jacobi, EigenVals, EigenVect Eigenvalues and Eigenvectors TPMath1 (Eigen)
Linear Equations Gauss-Jordan Elimination
LU decomposition
Singular value decomposition
Linear Equations,
Complex Coefficients
linear equation solution, LU decomposition (ludcmp) and backsubstitution (lubksb) recipes
Matrices   TPMath1 (Matrices)
Matrices, Complex Elements   TPMath1 (MatComp)
Matrix Shareware Product by SDL (Software Development Lohninger)
Matrix Math Toolkit Commerical Product from Engineering Objects International
Matrix Operations Dynamic Types:

MatrixIsRectangular, MatrixDimensions, MatrixIsSquare, MatricesSameDimensions, AddMatrices, AddToMatrix, SubtractMatrices, SubtractFromMatrix, MultiplyMatrixByConst, MultiplyMatrixByConst2, MultiplyMatrices, TransposeMatrix, GrandMean

mprove linear equation solution, iterative improvement recipes
Mult_Matrix add matrices A and B to give matrix C Turbo (p. 147)
svbksb singular value backsubstitution recipes
svdcmp singular value decomposition of a matrix recipes
TVector Vector component
toeplz solve Toeplitz systems recipes
tred2 Householder reduction of a real, symmetric matrix recipes
tqli eigensolution of a symmetric tridiagonal matrix recipes
tridag solution of tridiagonal systems recipes
vander Vandermonde systems recipes
Vector Vectors is a class library for Object Pascal (Delphi 1, 3-5 and Free Pascal v.0.99.15 and higher), which implements vectors (dynamically sized arrays) based on different Object Pascal's simple types, including all integer and real types, booleans, pointers and strings. These vectors resemble TList class type from Delphi VCL, but in addition to the common operations like  insert and delete they offer wide range of operations depending on type of vector elements - sorting, searching, arithmetic vector operations for number-type vectors, logical operations for boolean vectors and so on. The library also implements a range of derivative and additional classes - sparse vectors, matrixes, queues, stacks, dictionaries, streams from DSP
Vector Operations Dynamic types:

SquareAll, InverseAll, Log10All, LinearTransform, AddVectors, SubVectors, MultVectors, DotProduct



Digital Signal Processing, Fourier Analysis, FFTs

Numerical Methods in Pascal page

Function Name/Category Math Description Source(s)
adaptive FIR filter using LMS algorithm   ISPL

The Basic Delphi signal processing package (BDSPP).   The package represents FFT Properties 3.5 in parts. It includes key components on which FFT Properties 3.5 are based. The vast majority of the functionality offered by FFT Properties is available from these VCL components.

convlv convolution or deconvolution of data using FFT recipes
correl correlation or autocorrelation of data using FFT recipes
cosft fast cosine transform recipes
dsxfft Simple Fast Fourier Transformation Component. FFT and inverse FFT.
Delphi Super Page
evlmem power spectral estimation using maximum entropy coefficients recipes
FFT Unit for Delphi
  • FFT and inverse FFT routines for any number of samples
    (but if the number of samples is an exact power of 2, the faster power-of-2 FFT algorithm is used).
  • Can be used for real and complex signals.
  • FFFT (Fractional FFT) routines can provide any range of spectral lines (Zoom FFT).
  • Many data windows (Parzen, Welch, Hann, Hamming, Blackman, FlatTop, ...).
  • The source code of the FFT unit is available. 

FFT using TFastFourier component Fast Fourier Transform
fftprop2 Educational software for understanding the FFT properties.
finite impulse response (FIR) filter (many routines)   ISPL
fixrts reflect roots of a polynomial into unit circle recipes
four1 FFT in one dimension recipes
Fourier Analysis, FFTs   TPmath1(fourier)

DatabaseFTP:  Select "7Object Pascal" followed by "FFT_1.ZIP"
fourn FFT in multidimensions recipes
infinite impulse response (IIR) filter (many routines)   ISPL
Intel Signal Processing Library  Intel Signal Processing Library V4.1 Delphi interface patch and examples 
memcof evaluate maximum entropy coefficients recipes
miscellaneous signal processing functions Examples:
Permute vector into binary bit-reversed order,
uniform distribution, normal distribution, NSP tone generator, other tone functions, triangle functions, vector addition and multiplication, scalar and vector functions, autocorrelation, crosscorrelation, vector arithmetic and algebraic functions
where X is s, c, d, z, sd, cs, dz, zd, w
finite, linear convolution of two sequences ISPL
nspXConv2D, for X=s, d, w finite, linear convolution of two 2D signals ISPL
nspvReal, nspvImag Real and Imaginary part of Complex Vector ISPL
nspvbMag, nspvbPhas Magnitude and phase of Complex Vector ISPL
predic linear prediction using maximum entropy coefficients recipes
realft FFT of single real function recipes
Signal Processing Package   
sinft fast sine transform recipes
Single frequency DFT (Goertzel algorithm)   ISPL
spctrm power spectrum estimation using FFT recipes
TFastFourier Can transform data sets of up to 32k samples in both directions and provides several of the most important windowing functions (such as Hamming, Blackman, Cosine Square, Triangle, and others).

twofft FFT of two real functions recipes

Ordinary and Partial Differential Equations (ODEs and PDEs)

Numerical Methods in Pascal page 

Runge-Kutta ODE Algorithm 

Category Math Description Source(s)
bsstep integrate ODEs, Bulirsch-Stoer step recipes
mmid integrate ODEs by modified midipoint method recipes
odeint integrate ODEs with accuracy monitoring recipes
rk4 integrate one step of ODEs, fourth-order Runge-Kutta recipes
rkdumb integrate ODEs by fourth-order Runge-Kutta recipes
shoot solve two-point boundary value problem by shooting recipes
shootf solve two-point boundary value problem by shooting to a fitting point recipes
solvde two-point boundary value problem, solve by relaxation recipes
sor elliptic PDE solved by successive overrelation method recipes


Sources Key

Source Description/Location
AugMath Augmented Math (what Borland left out) 
ESB Consultancy
Developers of Mathematical & Statistical
Software and Delphi Software.

ESBMaths is a collection of Integer and Floating Point Routines for Delphi. Includes probability and statistical related routines

Freeware ESBMaths with Source.

EZMath ?
DSP Delphi Super Page (not to be confused with Digital Signal Processing):
ISPL Delphi interface for the Intel Signal Processing Library (5430 lines, 872 procedures and functions exported by NSP.DLL):

Intel Signal Processing Library:

math Borland's Delphi math unit
mathe Scientific Subroutine Library
recipes Numerical Recipes Pascal shareware version,
(On-line FORTRAN/C Books:

TP Math

Jean DeBord's TPMath 

Turbo Turbo Algorithms (C, Pascal, Basic, Prolog)
Keith Weiskamp, Namir Shamas, Ron Pronk
John Wiley, 1989 (Out of Print)
UDDF Math Unofficial Delphi Developers FAQ: (linki broken 30 July 2000)

Links Verified 30 Jul 2000
Updated 05 Jul 2003

since 1 Nov 1998