On this page

mathlib-fp

A collection of focused Free Pascal mathematics domains organised as a single source tree and distribution.

See the roadmap for the quality-first path toward a comprehensive native Free Pascal numerical package.

New to Free Pascal numerical code? Read the beginner guide, then choose a tested task from the beginner recipes. The recipes lead with the double-real, allocating path and link the advanced controls separately.

The cheatsheet is one page of canonical entry points; the task index covers five common tasks per domain.

See the comparison of Pascal numerical libraries for how mathlib-fp relates to other projects. The release maintenance view summarises each domain's stable surface, evidence, and limitations at a glance.

Getting the source

Get the source directly with git:


git clone --depth 1 --branch v1.9.9 \

  https://github.com/ikelaiah/mathlib-fp.git

or as a source archive with wget:


wget \

  https://github.com/ikelaiah/mathlib-fp/archive/refs/tags/v1.9.9.tar.gz

or with curl:


curl -L -o mathlib-fp.tar.gz \

  https://github.com/ikelaiah/mathlib-fp/archive/refs/tags/v1.9.9.tar.gz

> No package manager or install step is required for direct source use; add > src/ to the Free Pascal unit path, for example fpc -Fusrc ....

Direct source use is canonical; the Lazarus package remains a tested, versioned alternative.

Releases

Terminology

mathlib-fp uses the following terms consistently:

Term Meaning Example
Project or distribution The complete versioned source release mathlib-fp 1.3.0
Domain A functional area within mathlib-fp Finance, algebra, geometry
Unit family The shared prefix of related Pascal units FinanceLib, AlgebraLib
Unit A Pascal compilation unit named in a uses clause FinanceLib.Interest
Kit class A public calculation facade, usually exposing class-static methods TFinanceKit
Focused alias unit A narrow import path that aliases a Kit class or supporting types FinanceLib.Bonds
Lazarus package The optional IDE package containing the project units mathlib_fp.lpk

“Kit” describes an API class, not a domain or unit. Supporting units containing constants, types, low-level functions, or exception declarations do not need an artificial Kit class.

Domains

Unit family Domain Depends on
MathBase Shared types, constants, precision, trigonometry, local random state, bounded expressions, and numerical interchange RTL / FCL streams
AlgebraLib Compatibility matrices, typed dense storage/solvers, and structured/sparse/matrix-free linear algebra MathBase
FinanceLib Time value of money, bonds, NPV/IRR, options, ratios, risk metrics MathBase
StatsLib Descriptive/online statistics, paired distributions, inference, regression diagnostics, and bootstrap MathBase / AlgebraLib
EngineeringLib Fluid dynamics, thermodynamics, applied DSP, signal processing, unit conversion MathBase / AlgebraLib
NumericsLib Root finding and introductory numerical methods; advanced modelling MathBase / AlgebraLib
ProbabilityLib Continuous and discrete probability distributions MathBase
CombinatoricsLib Counting, sequences, number theory, permutations, combinations MathBase
OptimizationLib Diagnostic scalar/vector/constrained optimisation and two-phase LP; dense convex QP/SOCP MathBase / AlgebraLib / NumericsLib AD
TimeSeriesLib Smoothing, decomposition, ARIMA, anomaly detection, and scalar/multivariate state-space filtering MathBase / AlgebraLib
MLLib Preprocessing, regression, classifiers, clustering, forests, metrics, and typed reproducible analysis MathBase / AlgebraLib
InterchangeLib Versioned selected-model persistence adapters MathBase / selected model domains
GeometryLib 2-D and 3-D computational geometry MathBase

Public API naming inventory

Domain Primary units Public Kit classes
Math foundation MathBase.SharedTypes, MathBase.Complex, MathBase.MathConstants, MathBase.Precision, MathBase.Trigonometry, MathBase.Random, MathBase.Interchange, MathBase.Expressions TTrigKit, TLocalRandom, interchange procedures, TExpressionEvaluator
Algebra AlgebraLib.Matrices, AlgebraLib.VectorKernels, AlgebraLib.Vectors, AlgebraLib.Determinants, AlgebraLib.DenseMatrices, AlgebraLib.DenseKernels, AlgebraLib.DenseSolvers, AlgebraLib.DenseDecompositions, AlgebraLib.SparseMatrices, AlgebraLib.LinearOperators, AlgebraLib.IterativeSolvers, AlgebraLib.StructuredSolvers, AlgebraLib.PartialEigensystems TMatrixKit, TVectorKit, typed dense/sparse/operator/solver facades
Finance FinanceLib.Interest, FinanceLib.Bonds, FinanceLib.NPV TFinanceKit; aliases TBondKit, TNPVKit
Statistics StatsLib.Stats, StatsLib.Streaming, StatsLib.Inference TStatsKit, TOnlineStatistics, TInferenceKit
Engineering EngineeringLib.FluidDynamics, EngineeringLib.Thermodynamics, EngineeringLib.Signal, EngineeringLib.DSP, EngineeringLib.UnitConversion TFluidDynamicsKit, TThermodynamicsKit, TSignalKit, TDSPKit, block/streaming DSP records, TUnitConversionKit; supported compatibility aliases TVelocityKit, TPressureKit
Numerics NumericsLib.Numerics, NumericsLib.Differentiation, NumericsLib.Interpolation, NumericsLib.Modelling TNumericsKit, TDifferentiationKit, TInterpolationKit, TModellingKit
Probability ProbabilityLib.Distributions TProbabilityKit
Combinatorics CombinatoricsLib.Combinatorics TCombinatoricsKit
Optimization OptimizationLib.Optimization, OptimizationLib.Convex TOptimizationKit, TConvexOptimizationKit
Time series TimeSeriesLib.TimeSeries, TimeSeriesLib.StateSpace TTimeSeriesKit, TScalarKalmanFilter, TMultivariateKalmanFilter
Machine learning MLLib.MachineLearning, MLLib.Analysis TMLKit, TAnalysisKit, TKDTree, fitted analysis/forest records
Model interchange InterchangeLib.Models selected model save/load and summary procedures
Geometry GeometryLib.Geometry TGeometryKit

Dependency Graph


MathBase

├── AlgebraLib

├── FinanceLib

├── StatsLib

├── EngineeringLib

├── NumericsLib

├── ProbabilityLib

├── CombinatoricsLib

├── OptimizationLib

├── TimeSeriesLib

├── MLLib

├── InterchangeLib (optional adapters over selected domains)

└── GeometryLib

Common Base Types

All domains share the types defined in MathBase.SharedTypes:


TIntegerArray  = array of Integer;

TDoubleArray   = array of Double;

TSingleArray   = array of Single;

TExtendedArray = array of Extended;

TDoublePair    = record Lower, Upper: Double; end;

TComplexArray  = array of TComplex;  // MathBase.Complex

TSingleComplexArray = array of TSingleComplex;

Design Principles

  • Kit classes normally use static class methods for stateless calculations.
  • TMatrixKit also implements IMatrix; it is the established matrix factory and concrete implementation as well as the algebra Kit class.
  • The typed dense API is the contiguous single/double real/complex path. Its migration guide names copy and allocation costs.
  • Collection APIs use TDoubleArray, TIntegerArray, or documented matrix aliases.
  • Optional ADecimals parameters round scalar results where documented.
  • Invalid inputs raise typed exceptions such as EFinanceError, EStatsError, EMatrixError, EProbabilityError, or the domain-specific equivalent.

Find an algorithm

The problem-oriented beginner recipes are the shortest route when you know the task but not its Pascal identifier.

Problem Recommended starting point
Solve a square dense system Solve(A, B)
Repeated dense solves FactorLU
Positive-definite dense solve FactorCholesky
Typed matrix multiplication Multiply / MultiplyInto
Deterministic blocked matrix multiplication MultiplyBlockedInto / MultiplyAutoInto
Assemble or multiply a sparse matrix Sparse storage and operation contracts
Solve a large positive-definite system ConjugateGradient selection guide
Solve a general square or rectangular operator problem GMRES, BiCGSTAB, and LSQR selection
Repeated tridiagonal, band, or explicit sparse direct solve Reusable direct factors
Selected largest-magnitude eigenpairs Restarted Lanczos/Arnoldi
Compatibility IMatrix operations AlgebraLib compatibility reference
Interpolation, fitting, adaptive integration, vector roots, or ODEs Numerical modelling selection guide
Dense convex QP or second-order cones Convex optimisation selection guide
FFT/block convolution, inference, forests, or Kalman filtering Applied numerics guide
Portable numerical/model persistence, metadata, or bounded expressions Interchange guide
Supported and missing families Capability inventory

See the supported platform matrix for compiler, target, and precision qualifications.