Understanding the Art of Curve Fitting

Curve Fitting is the process of constructing a mathematical function that best fits a series of data points. It is the bridge between raw observations and theoretical understanding.

This interactive lab covers 9 essential curve models — from the simplest linear regression to the flexible Richards "master curve." Manipulate parameters with sliders and watch every curve respond in real time to build deep intuition.

Based on the article: The Physics of Your Product

9 Models Covered

Basic: Linear, Polynomial, Exponential, Logarithmic, Power Law

S-Shaped: Logistic, Gompertz, Richards, Weibull CDF

Basic Curves

The foundational curve families: Linear, Polynomial, Exponential, Logarithmic, and Power Law.

Every curve-fitting journey starts here. These five families cover the most common data patterns — constant growth, accelerating growth, diminishing returns, and scale-free decay. Select a curve type below and drag the sliders to see how each parameter shapes the function.

Parameters

y = a · x^b
Power Law: Scale-free behaviour. The gold standard for mobile gaming retention curves.

Vertical scale.

b<1 = diminishing, b>1 = accelerating.

2 4 6 8 10 0.5 1 1.5 2 2.5 3
Power Law Curve x y

// Mathematical Model

y = 1 · x0.5

S-Shaped (Sigmoidal) Growth Models

The most important curves for growth modeling: slow start, rapid growth, saturation.

Sigmoidal curves capture the universal pattern of bounded growth — from population dynamics to LTV prediction. The Logistic is symmetric, the Gompertz is asymmetric with fixed skew, the Richards "master curve" has an extra parameter that can morph into either, and the Weibull CDF offers a flexible survival-based S-shape.

Parameters

Logistic
Logistic: y = L / (1 + e-k(x-x₀)). Perfectly symmetric — the journey from 0% to 50% looks exactly like from 50% to 100%.

Maximum possible value (the plateau).

How fast the metric grows during rapid growth phase.

Exact time when growth hits its absolute peak.

0 5 10 15 20 0 20 40 60 80 100
Logistic Curve Time (t) y

// Mathematical Model

y = 100 / (1 + e-0.5(t - 9.5))

Inflection Point

t ≈ 9.5, y ≈ 50.0 (50% of K)

Where growth rate is at its maximum.

Optimizers in Action

Watch how different optimization algorithms find the best-fit curve in real time.

Curve fitting is an optimization problem: find the parameter values that minimize the difference between your model and the observed data. When you call scipy.optimize.curve_fit in Python, one of these algorithms runs under the hood. Watch each one converge from a poor initial guess to the optimal fit.

Optimizer Controls

LM
Levenberg-Marquardt: The default for unconstrained problems. Fast convergence but doesn't support parameter bounds.

Amount of scatter in the synthetic data.

Slow (1) → Normal (2) → Fast (3)

Live Fitting Stats

Iteration

0

RSS

Current Parameters

K=?, r=?, m=?

0 10 20 0 20 40 60 80 100 120
Observed Data True Model Live Curve Fitting Animation Time (t) Value

LM

Fastest for unconstrained. Uses Jacobian for direction. No bounds support.

TRF

Default with bounds. Robust for large problems. Slightly slower but safer.

Dogbox

Best for small bounded problems. Rectangular trust region. Very stable.

Which Curve Should You Use?

Match your data's shape to the right mathematical model.

Straight Line

Constant rate of change. Baseline model for any analysis.

Linear

Curved / Wiggly

Local peaks, valleys, or inflections. Flexible but can overfit.

Polynomial

Explosive Growth / Decay

Compound interest, radioactive decay, viral install spikes.

Exponential

Diminishing Returns

Fast initial gains that taper off. Ad spend ROI, learning curves.

Logarithmic

Scale-Free Decay

Heavy tails, retention curves. Gold standard for mobile gaming.

Power Law

S-Shape (Symmetric)

Inflection exactly at 50%. Population dynamics, adoption curves.

Logistic

S-Shape (Asymmetric)

Inflection below midpoint. Tumor growth, epidemics, flexible LTV.

Gompertz Richards

Survival / Risk S-Curve

S-shaped CDF for failure modeling, or PDF for density analysis.

Weibull CDF Weibull PDF

Don't Know Yet?

Start with Richards. Its extra ν parameter lets it reduce to Logistic or Gompertz automatically.

Richards (Master)