nlsq.core.functions.exponential_growth¶
- nlsq.core.functions.exponential_growth(x, a, b, c)[source]¶
Exponential growth: y = a * exp(b*x) + c
Common for population growth, compound interest, bacterial growth.
- Parameters:
- Returns:
y – Dependent variable
- Return type:
array_like
Notes
Doubling time: t_double = ln(2) / b
At x=0: y = a + c
As x→∞: y → ∞ (unbounded growth)
Examples
>>> from nlsq import curve_fit >>> from nlsq.core.functions import exponential_growth >>> import numpy as np >>> >>> # Bacterial growth with doubling time = ln(2)/0.3 ≈ 2.3 >>> x = np.linspace(0, 5, 50) >>> y = 10 * np.exp(0.3 * x) + np.random.normal(0, 1, 50) >>> popt, pcov = curve_fit(exponential_growth, x, y, p0='auto') >>> print(f"Doubling time: {np.log(2)/popt[1]:.2f}")