Skip to content

v0.5.0

Latest

Choose a tag to compare

@laszlopere laszlopere released this 07 Aug 05:34

Fifth release. No new tools this time — instead the two youngest ones grew up: the solver gained a full fleet of root finders and minimisers you can pick by name, and curve_fit went from 12 curve forms to 19.

Solver — ten new algorithms

Root finding, all in the chosen numeric type:

  • Sign-change bracketers: brent-dekker, chandrupatla and secant (joining the existing bisection and ridders), sharing one bracketing harness.
  • Derivative-following, bracket-free: newton-raphson and halley — they use the expression's own symbolic derivatives, so they also reach a root that merely touches zero and never changes sign.

Minimisation / maximisation:

  • ternary-search — the plain bracket-shrinking minimiser.
  • newton-optimise — steps to the zero of the objective's own slope; lands a quadratic in a single step.
  • bfgs — quasi-Newton gradient descent over several unknowns, far fewer iterations than a simplex on a smooth bowl.
  • powell — direction-set minimisation over several unknowns; derivative-free like Nelder-Mead, usually the cheapest of the three on a smooth objective.

Pass several unknowns to any multivariate engine with variables (a name → [lower, upper] map).

Curve fit — seven new forms (19 total)

All closed-form, each via its own linearisation:

  • Laurent a + b*x + c/x — direct linear basis {1, x, 1/x}.
  • exp-reciprocal / Arrhenius a*exp(b/x) — log-linear against 1/x.
  • Hoerl a*b**x*x**c — log-linear over the basis {1, x, ln x}.
  • Weibull CDF 1 - exp(-(x/a)**b) — the double-log Weibull plot.
  • Logistic a/(1 + exp(-(b*x + c))) — the logit, once the ceiling a is fixed from the data.
  • Generalized hyperbolic 1/(a*x**2 + b*x + c) and Lorentzian/Cauchy peak a/(1 + ((x-b)/c)**2) — a reciprocal-quadratic transform.

New functions

  • geomean / harmean — geometric and harmonic means, variadic with a vector overload.
  • sumsq — sum of squares Σ xi**2, variadic with a vector overload.
  • residual_sum_squares — least-squares cost of a model against paired data.
  • map — element-wise vector transform (a special form, like the range folds).

Fixes

  • Fixed-point ** no longer hangs the server on a fractional exponent.
  • newton-raphson / halley no longer return a root outside the bracket you gave them.