Block 83: SciPy: Optimization
Find minima, maxima, and roots of functions numerically.
Concepts
- scipy.optimize.minimize_scalar()
- scipy.optimize.minimize() for multivariate
- scipy.optimize.root_scalar() for roots
- Bounds and constraints
Code Examples
See exercise below.
Exercise
Find the minimum of f(x) = x^2 - 4x + 3. Verify analytically. Find the root of x^3 - 2x - 5 = 0 numerically.
Homework
Give 3 examples of real-world optimization problems that could be solved with scipy.optimize.