Gradient Descent Optimizer
Iteratively minimize f(x) by following the negative gradient
Parameters
Controls
Calculated Values
Examples
Parabola x² from x₀ = 2
Minimum at x = 0 with η = 0.1.
- x:
- f:
Double well x⁴ − 3x²
Two minima; depends on initial guess.
- x:
- f:
Visualization
Gradient Descent in Physics & ML
Gradient descent (steepest descent) is a first-order iterative optimization algorithm for finding a local minimum of a differentiable function. The negative gradient −∇f points in the direction of steepest decrease.
At each step: x_{n+1} = x_n − η·f′(x_n), where η is the learning rate. The animation traces the path from x₀ to the minimum, showing each intermediate evaluation.
In physics, gradient descent appears in energy minimization (relaxation methods), variational calculations, and fitting models to data by minimizing χ² or loss functions.
The learning rate η controls convergence: too small → slow; too large → oscillation or divergence. Adaptive methods like Adam adjust η per step in machine learning.
Key Concepts
- Negative gradient direction = steepest descent
- Learning rate η sets step size
- Only finds local minima (depends on x₀)
- Converges slowly near flat regions
- Can oscillate if η is too large
Real-World Applications
- Energy minimization in molecular dynamics
- Neural network training (backpropagation)
- Variational quantum Monte Carlo
- Least-squares fitting of physics models
Explore Further
- All Computational Physics Calculators
Browse every computational physics solver in this category.
- Statistical & Numerical Methods
Probability and ensemble ideas behind stochastic simulation.
- Statistics in Physics
Why averaging random samples recovers physical expectations.
- Bisection Method
Step in Numerical Methods.
- Newton-Raphson
Step in Numerical Methods.
- ODE Solver
Step in Numerical Methods.
- Monte Carlo Intro
Step in Numerical Methods.
- Physics Constants Reference
SI values for c, G, k_B, ε₀, and more used across solvers.
More computational physics tools
- 1D Heat Equation
Finite-difference FTCS solution to the diffusion equation with animated temperature profiles.
- 1D Wave Equation
Leapfrog finite-difference solution to the wave equation with animated wave propagation.
- Numerical Integration
Trapezoidal and Simpson rules to approximate definite integrals with error vs exact solutions.
- ODE Solver
Euler and Runge-Kutta 4 methods for first-order ODEs with comparison to analytic solutions.
- Monte Carlo Intro
Estimate π and integrals by random sampling — introduction to stochastic computational physics.
- Newton-Raphson
Solve nonlinear equations f(x) = 0 with tangent-line iterations — fast when the guess is good.
Physics Equations
Step-by-Step Solution
See how the main results are calculated.
Step 1: Objective function
Minimise f(x) = x² starting from x₀ = 2.
Calculation:
Step 2: Update rule
Learning rate η = 0.1.
Equation:
Explanation:
Each step moves opposite to the gradient, i.e. downhill toward a minimum.
Step 3: First iteration
Calculation:
Result:
Step 4: After 40 steps
Calculation:
Result:
Explanation:
Gradient is near zero — converged to a minimum.
Frequently Asked Questions (FAQ)
What happens with large learning rate?
The optimizer may overshoot and oscillate around the minimum or diverge entirely.
Can it find global minima?
Not guaranteed. Try multiple starting points or methods like simulated annealing.
Practice MCQs
- Gradient descent moves in the direction of:
- Too large η causes:
- For f(x) = x², the minimum is at:
- Gradient descent is a ___ order method.
- Local minima problem means:
- Momentum in gradient descent helps:
- For f(x) = x⁴ − 3x², how many local minima exist?
- A convex function guarantees:
- If gradient descent oscillates, the likely fix is:
- Stochastic gradient descent (SGD) differs from full GD by:
Related Calculators
These tools connect to the same physics concepts used in this calculator.