This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Fitting and optimization (vp.optimize)

Nonlinear least squares by MINPACK's Levenberg-Marquardt, with SciPy's names.

  • least_squares and root, as SciPy's method='lm'
  • curve_fit, which returns the parameters and their covariance as SciPy's does
  • residuals written in Viv, or in Python and translated by py2viv
  • exact Jacobians by reverse-mode differentiation, or MINPACK's forward differences

The port follows the Fortran step for step and is checked against the certified values of all 27 NIST nonlinear regression problems.

Part of the distribution vipyr; it runs from a checkout of the repository. Planned on PyPI as pip install vipyr.

Functions

vp.optimize.curve_fit
Fit a model's parameters to data by least squares and estimate their covariance, as SciPy's curve_fit.
vp.optimize.least_squares
Minimize a sum of squares of nonlinear residuals by MINPACK's Levenberg-Marquardt, with the residuals in Viv.
vp.optimize.root
Solve a square nonlinear system F(x) = 0 by Levenberg-Marquardt, as SciPy's root(method='lm').

Examples in the gallery