Optimization (Numerical)
Find minima, maxima and best-fit parameters with scipy.optimize.
Intermediate
from scipy.optimize import minimize, curve_fit
res = minimize(lambda x: (x[0] - 3)**2 + 1, x0=[0])
popt, _ = curve_fit(lambda t, tau: 5 * (1 - np.exp(-t / tau)), t, v) # fit an RC curve
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.