6.2b Bisection labs
Source: Lab ideas from Computational Physics (Landau, Páez, Bordeianu), §6.1–6.2. Rewritten as original drills — not textbook
Bisection.py. Continues 6.2 Bisection search.
Implement interval halving, probe the even square-well residual, and lock . Stubs fail until filled in.
Use
with (math.sin / math.cos). Hint only: guard against if you leave the safe bracket.
Bisection convention for graded output: while with , set ; if then , else (update the stored ). Return the final midpoint .
Formula refresh
Warm up: pick the matching equation among lookalikes (same walk as the theory lesson).
Labs
Find a root of on by bisection (). Print the root with 10 decimals.
No input.
Write-ups
Using “sign”, “bracket”, and “half”, explain:
In one sentence: what does bisection do with the midpoint when ?
Minimum 3 words. Your answer must include: “sign”, “bracket”, “half”.
Meet the writing requirements, then you can open the model answer.
Explorers
Next: 6.3 Newton–Raphson search — faster local root-finding (then labs, then §6.5 Lagrange).