A comprehensive Clojure library for numerical optimization, root-finding, interpolation, and regression. Built on Hipparchus, OjAlgo, jcobyla, and Incanter.
-
root-solvers— Univariate root-finding with multiple algorithms: Brent-Dekker, modified Newton-Raphson, Muller, plus Hipparchus methods (bisection, Brent, Illinois, Pegasus, Ridders, secant, Regula-Falsi). Includes quadratic equation solver. -
integer-root-solvers— Bisection algorithm for strictly increasing discrete functions. Returns the minimum integer with function value ≥ 0. -
plateau-root-solvers— Root-finding for monotonic functions that return plateau values. Supports univariate and multivariate cases.
-
optimize-univariate— Brent optimizer for 1D minimization/maximization over bounded intervals. -
integer-optimize— Custom integer maximizer that exponentially focuses search around a guess. Handles functions with at most one sign change in derivative. -
linear-programming— Two-phase Simplex Method. Minimizes/maximizes linear objectives subject to linear constraints (equality, ≤, ≥). -
quadratic-programming— Minimizes (1/2)x^T P x + q^T x subject to equality and inequality constraints using OjAlgo. -
nonlinear-programming— Multiple solvers for nonlinear optimization:- Constrained: Cobyla for inequality constraints
- Unbounded: Powell, Nelder-Mead, Multi-directional Simplex, Conjugate Gradient (Polak-Ribière, Fletcher-Reeves)
- Bounded: BOBYQA, Cobyla, CMA-ES (evolutionary, handles non-smooth/non-convex objectives)
nonlinear-constraints-without-objective— Finds variable values that satisfy nonlinear constraints:- Nonlinear Least Squares (Levenberg-Marquardt, Gauss-Newton)
- Nonlinear Ordered Constraints (prioritized constraint satisfaction)
interpolation— Comprehensive interpolation functions:- 1D: cubic spline, Akima, LOESS, linear, polynomial, Neville, quadratic, cubic-clamped, Hermite
- 2D: polynomial, bicubic, bicubic-Hermite, bilinear
- 3D: tricubic
- N-D: microsphere interpolation
- Slope interpolation variants for derivatives
-
logistic-regression— Iteratively Reweighted Least Squares (IRLS) with optional ridge regularization. -
multinomial-logistic-regression— IRLS for multi-class classification. -
generalized-regression-neural-network— GRNN for non-parametric regression with automatic spread parameter optimization.
iterative-linear-least-squares— Iterative solvers for symmetric linear systems (A × y = b): SYMMLQ and Conjugate Gradient methods.
(require '[provisdom.solvers.root-solvers :as root])
(require '[provisdom.solvers.nonlinear-programming :as nlp])
(require '[provisdom.solvers.interpolation :as interp])
;; Find root of f(x) = x³ - 3x
(root/root-solver
{::root/univariate-f (fn [x] (- (* x x x) (* 3 x)))
::root/guess 2.0
::root/interval [-5.0 5.0]})
;; Minimize f(x,y) = x² + y² subject to bounds
(nlp/bounded-nonlinear-programming-without-evolutionary
{::nlp/objective (fn [da] (let [[x y] da] (+ (* x x) (* y y))))
::nlp/vars-guess [1.0 1.0]
::nlp/var-intervals [[-10.0 10.0] [-10.0 10.0]]})
;; Cubic spline interpolation
(let [f (interp/interpolation-1D
{::interp/x-vals [0.0 1.0 2.0 3.0]
::interp/f-vals [0.0 1.0 4.0 9.0]})]
(f 1.5))- Hipparchus — root-finding, optimization, interpolation, least squares (replaces Apache Commons Math)
- OjAlgo — linear and quadratic programming
- jcobyla — constrained nonlinear optimization (COBYLA algorithm)
- Incanter — 2D interpolation (bicubic, bilinear, polynomial)
Copyright © 2018-2026 Provisdom Corp.
Distributed under the GNU Lesser General Public License version 3.0.