Numerical Function Minimization via Gradient Descent
Write a function that takes an arbitrary differentiable function $f(x)$ as its argument and finds a value $x$ that minimizes $f(x)$. You should implement a numerical solution using gradient descent.
Specifically:
1. Implement gradient descent using a numerical approximation to the derivative.
2. Discuss the tradeoffs between forward difference and central difference for approximating $f'(x)$.
3. Describe at least two enhancements that improve convergence (e.g., adaptive step size, Newton's method).
**Constraints:**
- $f$ is a scalar function $\mathbb{R} \to \mathbb{R}$
- Assume $f$ is differentiable and has at least one local minimum
- You do not have access to an analytic derivative
Open the full interactive solver, hints, and worked solution →