Visual Optimization for Programmers

By dan • June 1, 2026 • 1 min read

# Visual Optimization for Programmers

Canonical public lesson for optimization.

## One picture
Optimization means finding the best point: maximum, minimum, cheapest, fastest, strongest, or most efficient.

## Simple idea
On a smooth curve, a best point often happens where the slope flattens.

```text
slope = 0
```

## Programmer view
Search nearby values and compare outputs.

```python
best_x = None
best_y = None

for i in range(1000):
x = i / 100
y = f(x)
if best_y is None or y > best_y:
best_x = x
best_y = y
```

## Calculus view
Use the derivative to find where slope changes from positive to negative or negative to positive.

Source task: `a87fa514-4efb-48c7-987d-1334e79ba512`