The unit MATH2 offers some of the most fundamental procedures of univariate statistics (such as mean values, standard deviations, or the correlation coefficient for a series of data pairs). In addition, several more advanced mathematical methods (such as the calculation of eigenvectors and principal components, a simple clustering algorithm, and the smoothing of data) are contained in this unit. The unit MATH2 also contains a simple, yet powerful class (TCurveFit) which supports curve fitting of univariate data. More details can be found in the online help pages.
The unit MATH2 is part of the SDL Component
Suite.
Please note that there are additional free programming examples which are not included in the component suite package:
CLUSTER 

SPLINE  shows how to use cubic splines 
RANDGEN  implements a configurable random generator 
What's new:
 Release 10.7 [Aug24, 2020]
 the function CalcRanks calculates the ranks of data in a vector
 the function ReducePolygon allows to remove superfluous vertices from a polygon
 the function CreateSigmoidArray fills an array with values of the sigmoid function
 the function CreateGaussianPeaks generates a signal based on Gaussian peaks
 the function Gauss2D fill an array with value from a Gaussian radial basis function
 the functions ApplyCompassKernel and ApplyKirschKernel filter a 2D matrix by the compass and the Kirsch kernel, respectively
 the new function KernelConvolve is a general 2D kernel convolving function
 TMathExpression.HelperObject implemented
 the function ExtractVarNames scans a mathematical expression for variable names
 the functions ConvertFromDiffPolygon and ConvertToDiffPolygon allow to convert polygons between absolute and relative coordinates
 Release 10.6 [Mar09, 2018]
 TCurveFit.CalcLinFit raises now an exception if the slope becomes infinite
 the function PolygonArea provides now a second overloaded version which counts the intersections
 the function DistanceToPolygon calculates the closest distance from a point to a polygon
 the function PolygonLength calculates the length of a polygon
 the functions TCurveFit.CalcPolyFit and TCurveFit.CalcCenteredPolyFit have been extended by alpha (the pvalues of the parameters)
 Release 10.5 [Oct10, 2016]
 the function CheckParanthInExp checks the correctness of parantheses in mathematical expressions
 the OnVarRequest event of TMathExpression has been extended to include the position of the variable name
 the procedure MovingKernelFilter implements a moving kernel filter
 the following sinc filter kernels are now supported: CalcSincLPKernel, CalcSincHPKernel, CalcSincBPKernel, CalcSincBSKernel
 Chebychev filter implemented: ChebychevFilter, CalcChebFilterCoeffs
 Release 10.4 [Jun02, 2015]
 the new function VertexCompAnalysis implements the vertex component analysis
 EnterStatValue is now a function returning the number of stored data points
 TMathExpression includes now a help context id on exceptions of the type ESDLMathExp.
 the function kMeansEstimatedSteps returns the estimated number of required processing steps of kMeans clustering
 the new procedure OuterRectOfPolygon returns the circumscribing rectangle of a polygon
 bug fix: PointIsInsidePolygon returned wrong result in degenerate cases
 Release 10.3 [Oct06, 2014]
 speed of AgglomClustering increased substantially (factor five to ten)
 kMeansClustering now provides an overloaded version to control the selection of the initial centers
 kMeansClustering returns now the sum of squares of the intraclass distances
 the procedure TCurveFit.FlipXY exchanges the x and y variables
 TMathExpression now supports the predefined reference variable symbol ° (degree)
 bug fix: TCurveFit.SpearmanRankCorr now works with large data sets as expected (was roundoff and overflow error)
 Release 10.2 [May30, 2013]
 the new function MahalanobisDistance calculates the Mahalanobis distance between two points in ndimensional space
 the new function MovingMedianSmooth smoothes data by a moving median
 the function EstimateByKNN now supports two new weighting modes (kwmLinear and kwmBiQuad)
 bug fix: TCurveFit.SpearmanRankCorr, TCurveFit.KendallsTau, and TCurveFit.KruskalGamma crashed if all data were constant
 bug fix: AgglomClustering returned slightly shifted distance values for Ward's method
 Release 10.1 [Oct29, 2012]
 the new function PseudoInverse calculates the MoorePenrose inverse
 the new function PointIsInsidePolygon tests whether a point is located within a closed polygon
 the new procedures MovingAverageSmooth and WeightedAverageSmooth implement the "moving average" and the "weighted average" smoothing algorithms
 the property TMathExpression.Expression supports now the calculation of the sum, the mean and the variance of a list of variables
 the function AgglomClustering may now be aborted by setting the global variable AbortMathProc to TRUE
 the property TCurveFit.KendallsTau has been changed to become a function which returns the level of signficance as a variable parameter
 the property TExtractor.ExtractionCommands has been extended to accept the command "assign"
 SimPLS now calls the global procedure MathFeedBackProc
 bug fix and improvement: TCurveFit.SpearmanRankCorr now uses adjusted formula if ties occur in the data
 bug fix and improvement: TCurveFit.CubicSpline now checks for equal xvalues and raises an exception
 bug fix: TCurveFit.KendallsTau does not create an integer overflow any more for large samples
 Release 10.0 [Oct4, 2011]
 the procedure SimPLS implements the SIMPLS algorithm for partial least squares regression
 the new methods RidgeReg and RidgeRegStd provide the ridge regression algorithm
 TMathExpression: variable names may now contain German umlauts
 new class TStringSearch implemented
 the class TCurveFit uses now extended precision internally to avoid floating point overflow in special cases
 bug fix: TCurveFit.MeanX, TCurveFit.MeanY, TCurveFit.MeanDiff do no longer crash if no data has been entered
 Release 9.7 [May31, 2010]
 new methods TCurveFit.QuartilesX and TCurveFit.QuartilesY calculate the quartiles of data in the TCurveFit container
 class TMathExpression supports now three new functions: nddens, ndint, and ndquant calculate the density, the integral, and the quantile of a standard normal distribution, respectively.
 ExportAsASC is now a function (instead of a procedure) returning an error message if the file cannot be created or overwritten
 the new method TCurveFit.CalcAnovaReg performs the analysis of variances
 bug fix: CalcCovar crashed if the target matrix was too small
 bug fix: TCurveFit.SpearmanRankCorr does not crash any more if more than approx. 1250 values are used for the calculation
 bug fix: TCurveFit.SmoothedSpline calculates the smoothed spline at position TCurveFit.MaxX as well
 Release 9.51 [Dec01, 2008]
 new function PointIsInsideConvexHull checks whether a point is inside or outside of a convex hull
 bug fix: procedure Convex2DHull produced wrong results if the xcoordinates of two neighboring points were exactly equal
 Release 9.5 [Oct31, 2008]
 properties TCurveFit.SkewnessX and TCurveFit.SkewnessY implemented
 properties TCurveFit.KurtosisX and TCurveFit.KurtosisY implemented
 methods TCurveFit.CalcPowerFit, TCurveFit.CalcHoerlFit, and TCurveFit.CalcExponentialFit now rise an exception if the function cannot be fitted
 method TCurveFit.CalcCenteredPolyFit implemented
 method TCurveFit.CalcPolyFit now provides feedback on numerical instabilities (parameter NearSingular)
 TMathExpression now offers new function "sign" to calculate the sign of a variable
 methods TCurveFit.CalcLinFit, TCurveFit.CalcParabolFit, TCurveFit.CalcGaussFit, ... improved to create better fit with data shifted far away from the origin
 bug fix: TCurveFit.CalcCircleFit does not crash anymore, if radius becomes infinite
 bug fix: TMathExpression now calculates the correct result if argument of an odd power is negative
 bug fix: unary minus and signs are now interpreted correctly by TMathExpression
 bug fix: TCurveFit.CalcLinFit does not crash anymore if all data points are zero
 bug fix: TMathExpression.Evaluate: function Gauss does no longer create a range check error
 Release 9.0 [May28, 2007]
 The algorithm used for TCurveFit.CalcPolyFit has been replaced by an SVD based version which is much more stable for higher orders (up to MaxPolyFitOrder).
 second order derivative of SavitzkyGolay smoothed filter implemented
 Release 8.5 [Feb18, 2006]
 the routine CalcPrincComp is now available in a second overloaded version which allows to select whether to normalize the eigenvalues or not.
 CalcCovar now calculates the squared correlation coefficients and the sum of squared differences as additional options (mode=3, or 4)
 kMeansClustering implemented
 the coefficients of the SavitzkyGolayPolynomials are now publicly available (see GolayPoly)
 TCurveFit.MeanAngleX, TCurveFit.MeanAngleY for the calculation of mean angles implemented
 Release 8.2 [Nov03, 2004]
 TCurveFit now checks for any error conditions when calculating a fit
 new curve fitting methods: CalcExponentialFit
 function to calculate the correlation of images implemented: CalcImgCorrelation
 bug fix: result of ScanDateTime is now stored as double (TDateTime instead of string)
 Release 8.1 [Aug29, 2004]
 available for Delphi™ 8 for .NET
 command "scandatetime" added to TExtractor class
 TExtractor: type of variable can now be determined by extraction script (as a syntax extension to the emit command)
 TCurveFit offers now more regression functions: CalcCircleFit, CalcReciLogFit, CalcReciHyperbolFit, CalcPowerFit, and CalcHoerlFit
 bug fix: PenalizedCubicSpline does no longer generate range check errors
 bug fix: TExtractor.Source does not strip off leading or trailing blanks anymore
 Release 8.0 [Apr15, 2004]
 new function PolygonArea implemented
 new function Convex2DHull calculates convex hull of a twodimensional data set
 new class TMathExpression supports the interpretation of mathematical formulas
 new class TExtractor supports command driven extraction of values from strings
 new procedure to calculate penalized splines implemented (PenalizedCubicSpline)
 additional clustering method: Unweighted Pair Group with Arithmetic Mean (UPGMA)
 AgglomClustering has now different feedback mode
 TCurveFit: new properties MinX, MinY, MaxX, MaxY
 TCurveFit: ExportAsASC, ImportASC
 smoothed splines as additional curve fitting method (SplineSmoothingFactor, SmoothedSpline)
 Release 7.2 [Mar23, 2003]
 MATH2 is now part of MathPack
 accuracy of SVD improved (had numerical problems when applying it to data covering a range of 8 decades or more)
 Release 7.0 [Sep15, 2002]
 available for Delphi™ 7.0
 the unit is now CLX compatible
 bug fix: memory leak in CubicSpline fixed
 Release 6.5 [May28, 2002]
 available for C++Builder™ 6.0
 SphereGreatCircleDist implemented

Release 6.0 [Aug06, 2001]
 available for Delphi™ 6.0
 CalcEigVec now increments the ProcStat variable with better granularity
 CalcCovar and CalcEigVec can be aborted by setting AbortMathProc
 EstimateByKNN implemented

FindNearestNeighbors improved: distance calculation can now be performed
by a user defined function

Release 5.5 [May21, 2000]

available for C++Builder™ 5.0

Release 5.0 [Oct09, 1999]
 MATH2 is now available for Delphi™ 5.0 (as part of the SDL Component Suite 5.0)
 cubic spline interpolation implemented (methods and properties CubicSpline, SplineNatural1, SplineNaturalN, SplineDerivY1, SplineDerivYN)
 multiple linear regression implemented (MultiLinreg)
 singular value decomposition implemented (SingValDecomp, SingValEquSolve)
 bug fixed in MeanDistanceKNN and FindNearestNeighbors which caused

wrong results with Delphi™ 1 to 3 (but not Delphi™ 4)

Release 1.8 [Mar27, 1999]
 MATH2 now available for C++Builder™ 4.0
 TCurveFit now additionally stores the data entered to it
 properties DataX and DataY implemented

method RemoveStatValue implemented

Release 1.7 [Jul23, 1998]
 MATH2 now available for Delphi™ 4.0
 statistical function moved to unit STATIS (KolmogorovSmirnov, WeibullDensity, LnGamma, LnBeta, LnBinomCoeff, BinomCoeff, nDistri, tDistri)

agglomerative clustering implemented

Release 1.6 (Apr08, 1998)
 MATH2 is now available for all versions of Delphi™ (1.0, 2.0, 3.0), and for C++Builder™ (1.0 and 3.0)
 DCommon no longer needed
 KolmogorovSmirnov onesample test statistic
 GetEigenSize implemented
 WeibullDensity implemented
 PolyFit implemented (basic code supplied by Kerry L. Davison  thanks Kerry !)
 calculation of Gamma function
 calculation of Beta function
 calculation of binomial coefficient
 exception ESDLMath2Error introduced
 Polynomial smoothing of data series (alg. Savitzky/Golay)

Smoothed first derivative of a series of data points

Release 1.5 (May28, 1997)
 MATH2 is now available for all three versions of Delphi™ and for C++Builder™