Golden-Section Calculator
The Bisection Calculator closes in on a root by reading a sign: f is negative on one side, positive on the other, and the midpoint tells you which half to keep. A minimum offers no such sign — the curve comes down to the floor and goes back up, positive the whole way. Golden-section search is bisection's counterpart for valleys: keep two interior probes, each 0.618 of the window in from an end, and compare them. On a single valley the higher probe rules out the whole stretch beyond it, so one end drops for certain; and because 0.618 is the golden ratio's complement, the surviving probe already sits exactly where the next pair needs it — every iteration costs one fresh evaluation and shrinks the bracket ×0.618.
Type an expression in x and it is minimized as-is. Type a full equation
f(x) = g(x) and it is solved as least squares — minimizing the squared
gap (f − g)², whose floor sits where the sides meet. That is the shape of
the goal · regular engine's λ₃
fit: a miss to minimize, not a sign to read — and that page's step 4 emits
a paste for this calculator, the same expression its bisection paste uses,
walked down as the valley it is. Every probe pair is narrated below, exactly
like the fit's own trace.
Seeded with the same Poisson-tail equation the Bisection page opens with:
Ptail(2.50, x) = 0.47854397. Read as least squares it converges to the same
λ ≈ 2.587961 — two searches, one answer.
The honest caveat: golden-section's guarantee needs one valley in the
bracket. With two (the cos chip) the comparisons walk into one of them and
never see the other — so the calculator first scans the bracket and counts
the dips, and warns when the closed valley is not the deepest one it saw. A
floor that slides to the bracket's edge (a monotone stretch) is flagged too.
↑/↓ steps a bracket bound, Shift steps bigger.
Probes sit 0.618 of the width from each end, so the survivor lands exactly where the next pair needs it: one fresh evaluation per step, width ×0.618
Comparisons to a tolerance τ: ⌈ln(τ/(b − a))/ln 0.618⌉ — here ⌈ln(1e-6/8)/ln 0.618⌉ = 34
| x* | minimum — closed from [0, 8] in 34 comparisons, 36 evaluations (the setup pair + one per step)f(x*) = 2.926e-18 — the best probe SEEN ships, not the final midpoint (ties with the odds engine's λ₃ fit) | 2.5879612 |
| · | sampled 97 points, one every 0.0833333, across [0, 8]a sample sitting at/below both neighbours marks a valley — dips narrower than one spacing can hide | 1 dip |
| 1 | dip 1 near x ≈ 2.58333f ≈ 1.359e-6 there | the valley |
| 0 | start: bracket [0, 8], width 8.000000 — place two probes 0.618 of the width in from each endc = 3.0557281 and d = 4.9442719 (a mirror pair: c + d = a + b); f(c) = 0.012240, f(d) = 0.153688 | 2 evaluations |
| 1 | window [0.0000000, 8.0000000] → compare f(3.0557281) = 0.012240 with f(4.9442719) = 0.153688f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 1.8885438 (f = 0.034357) | ◀ keep the left part |
| 2 | window [0.0000000, 4.9442719] → compare f(1.8885438) = 0.034357 with f(3.0557281) = 0.012240f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 3.7770876 (f = 0.061921) | keep the right part ▶ |
| 3 | window [1.8885438, 4.9442719] → compare f(3.0557281) = 0.012240 with f(3.7770876) = 0.061921f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.6099034 (f = 3.036e-5) | ◀ keep the left part |
| 4 | window [1.8885438, 3.7770876] → compare f(2.6099034) = 3.036e-5 with f(3.0557281) = 0.012240f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.3343685 (f = 0.004289) | ◀ keep the left part |
| 5 | window [1.8885438, 3.0557281] → compare f(2.3343685) = 0.004289 with f(2.6099034) = 3.036e-5f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.7801933 (f = 0.002234) | keep the right part ▶ |
| 6 | window [2.3343685, 3.0557281] → compare f(2.6099034) = 3.036e-5 with f(2.7801933) = 0.002234f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5046584 (f = 0.000448) | ◀ keep the left part |
| 7 | window [2.3343685, 2.7801933] → compare f(2.5046584) = 0.000448 with f(2.6099034) = 3.036e-5f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.6749483 (f = 0.000470) | keep the right part ▶ |
| 8 | window [2.5046584, 2.7801933] → compare f(2.6099034) = 3.036e-5 with f(2.6749483) = 0.000470f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5697034 (f = 2.121e-5) | ◀ keep the left part |
| 9 | window [2.5046584, 2.6749483] → compare f(2.5697034) = 2.121e-5 with f(2.6099034) = 3.036e-5f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5448584 (f = 0.000119) | ◀ keep the left part |
| 10 | window [2.5046584, 2.6099034] → compare f(2.5448584) = 0.000119 with f(2.5697034) = 2.121e-5f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5850584 (f = 5.343e-7) | keep the right part ▶ |
| 11 | window [2.5448584, 2.6099034] → compare f(2.5697034) = 2.121e-5 with f(2.5850584) = 5.343e-7f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5945483 (f = 2.746e-6) | keep the right part ▶ |
| 12 | window [2.5697034, 2.6099034] → compare f(2.5850584) = 5.343e-7 with f(2.5945483) = 2.746e-6f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5791933 (f = 4.881e-6) | ◀ keep the left part |
| 13 | window [2.5697034, 2.5945483] → compare f(2.5791933) = 4.881e-6 with f(2.5850584) = 5.343e-7f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5886832 (f = 3.303e-8) | keep the right part ▶ |
| 14 | window [2.5791933, 2.5945483] → compare f(2.5850584) = 5.343e-7 with f(2.5886832) = 3.303e-8f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5909235 (f = 5.557e-7) | keep the right part ▶ |
| 15 | window [2.5850584, 2.5945483] → compare f(2.5886832) = 3.303e-8 with f(2.5909235) = 5.557e-7f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5872987 (f = 2.782e-8) | ◀ keep the left part |
| 16 | window [2.5850584, 2.5909235] → compare f(2.5872987) = 2.782e-8 with f(2.5886832) = 3.303e-8f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5864430 (f = 1.461e-7) | ◀ keep the left part |
| 17 | window [2.5850584, 2.5886832] → compare f(2.5864430) = 1.461e-7 with f(2.5872987) = 2.782e-8f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5878275 (f = 1.132e-9) | keep the right part ▶ |
| 18 | window [2.5864430, 2.5886832] → compare f(2.5872987) = 2.782e-8 with f(2.5878275) = 1.132e-9f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5881544 (f = 2.365e-9) | keep the right part ▶ |
| 19 | window [2.5872987, 2.5886832] → compare f(2.5878275) = 1.132e-9 with f(2.5881544) = 2.365e-9f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5876255 (f = 7.142e-9) | ◀ keep the left part |
| 20 | window [2.5872987, 2.5881544] → compare f(2.5876255) = 7.142e-9 with f(2.5878275) = 1.132e-9f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5879524 (f = 4.944e-12) | keep the right part ▶ |
| 21 | window [2.5876255, 2.5881544] → compare f(2.5878275) = 1.132e-9 with f(2.5879524) = 4.944e-12f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5880295 (f = 2.958e-10) | keep the right part ▶ |
| 22 | window [2.5878275, 2.5881544] → compare f(2.5879524) = 4.944e-12 with f(2.5880295) = 2.958e-10f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5879047 (f = 2.024e-10) | ◀ keep the left part |
| 23 | window [2.5878275, 2.5880295] → compare f(2.5879047) = 2.024e-10 with f(2.5879524) = 4.944e-12f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5879819 (f = 2.700e-11) | keep the right part ▶ |
| 24 | window [2.5879047, 2.5880295] → compare f(2.5879524) = 4.944e-12 with f(2.5879819) = 2.700e-11f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5879342 (f = 4.636e-11) | ◀ keep the left part |
| 25 | window [2.5879047, 2.5879819] → compare f(2.5879342) = 4.636e-11 with f(2.5879524) = 4.944e-12f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5879636 (f = 3.726e-13) | keep the right part ▶ |
| 26 | window [2.5879342, 2.5879819] → compare f(2.5879524) = 4.944e-12 with f(2.5879636) = 3.726e-13f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5879706 (f = 5.578e-12) | keep the right part ▶ |
| 27 | window [2.5879524, 2.5879819] → compare f(2.5879636) = 3.726e-13 with f(2.5879706) = 5.578e-12f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5879593 (f = 2.229e-13) | ◀ keep the left part |
| 28 | window [2.5879524, 2.5879706] → compare f(2.5879593) = 2.229e-13 with f(2.5879636) = 3.726e-13f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5879567 (f = 1.302e-12) | ◀ keep the left part |
| 29 | window [2.5879524, 2.5879636] → compare f(2.5879567) = 1.302e-12 with f(2.5879593) = 2.229e-13f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5879610 (f = 3.435e-15) | keep the right part ▶ |
| 30 | window [2.5879567, 2.5879636] → compare f(2.5879593) = 2.229e-13 with f(2.5879610) = 3.435e-15f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5879620 (f = 3.878e-14) | keep the right part ▶ |
| 31 | window [2.5879593, 2.5879636] → compare f(2.5879610) = 3.435e-15 with f(2.5879620) = 3.878e-14f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5879604 (f = 4.689e-14) | ◀ keep the left part |
| 32 | window [2.5879593, 2.5879620] → compare f(2.5879604) = 4.689e-14 with f(2.5879610) = 3.435e-15f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5879614 (f = 1.520e-15) | keep the right part ▶ |
| 33 | window [2.5879604, 2.5879620] → compare f(2.5879610) = 3.435e-15 with f(2.5879614) = 1.520e-15f(c) > f(d): the floor cannot sit before c — drop [a, c); d is reused as the new c, one fresh probe at 2.5879616 (f = 9.864e-15) | keep the right part ▶ |
| 34 | window [2.5879610, 2.5879620] → compare f(2.5879614) = 1.520e-15 with f(2.5879616) = 9.864e-15f(c) ≤ f(d): on one valley the floor cannot sit past d — drop (d, b]; c is reused as the new d, one fresh probe at 2.5879612 (f = 2.926e-18) | ◀ keep the left part |
| ✓ | window [2.5879610, 2.5879616] is 6.27e-7 wide — inside the 1e-6 toleranceship the best probe seen anywhere: x* = 2.5879612, f(x*) = 2.926e-18 | 2.5879612 |