Instructions
Data format (MRA style)
any notes, ignored until the first double colon...
:: Title of the run <- text after the marker becomes the title
1 2 x column, y column <- text after the numbers is a comment
0.0 11.52 <- RAW data rows: spaces, tabs or commas
0.5 9.84
...
15.0 1.53 :: End <- a double colon ends the data; this row is kept
Do not type a double colon in the notes above the start marker.
Model block contract (model.js)
The block is the body of a function and must return an object:
return {
TITLE: "Exponential decay",
EQUATION: "y = A·exp(−k·x) + C", // shown under the parameter table
LABEL_X: "time (s)", LABEL_Y: "signal",
LOG_X: false, // start with a log x axis
PARAMS: [ // order = order of p[] in f()
{ name: "A", init: 5 },
{ name: "k", init: 1, min: 0 }, // optional min / max bounds
{ name: "C", init: 0 },
],
f: function (x, p) {
const [A, k, C] = p;
return A * Math.exp(-k * x) + C;
},
};
Methods
| Method | Use it when | Notes |
| LM Levenberg-Marquardt | almost always; default | blends gradient descent (far) and Gauss-Newton (near) through its damping λ |
| GN Gauss-Newton | already close to the answer | fastest near the minimum; step-halving keeps it from blowing up, but it can stall far away |
| NM Nelder-Mead | poor starting values, rough or kinked models | no derivatives; slow but sure; finish with LM for accurate errors |
| DE Differential Evolution | several local minima (oscillations, peaks); try the Sine wave sample | global search inside the bounds; parameters with no bounds search ±(2·|value|+1) around the current value; finish with LM |
All methods share one parameter vector, so switching the Method menu while a fit runs simply
continues from where the previous method left off. A typical hard fit: DE to find the right
valley, then LM to polish. The fit pauses itself when progress stops ("converged").
Report
- Standard errors come from s²(J′J)−1 at the final parameters, s² = SSE/(n − p). This is the usual
asymptotic (linearised) estimate, the same as SciPy curve_fit, GraphPad and most fit packages.
- Confidence intervals and p-values assume independent, normally distributed errors. Points along one smooth
trace are correlated, so treat them as optimistic there.
- High parameter correlations (|r| > 0.95) mean the data cannot separate those parameters well.
- AIC = n·ln(SSE/n) + 2p compares models on the same data: lower is better.
Lua / Pascal to JavaScript
| x ^ 2 | x ** 2 |
| exp(x), ln(x) | Math.exp(x), Math.log(x) |
| arrays from 1 | arrays from 0: p[0] is the first parameter |
NLCF V2026.1 Web · Non-Linear Curve Fitting © CompuRight Industries, G. Argraves · by Gary Argraves & Claude