1# F5-dev-01 — Cobb–Douglas consumer: closed-form demands with numerical validation23## Question4A consumer with u(x1,x2) = α ln x1 + (1−α) ln x2 chooses x1, x2 ≥ 0 subject to p1x1 + p2x2 ≤ m. We derive the Marshallian5demands, the indirect utility and the budget residual in closed form, evaluate them at the parameters in `data/parameters.csv`,6and validate them by an independent numerical maximisation of u that does not use the closed form.78## Data and exclusions9`data/parameters.csv` (SHA-256 a04798ad…4722, matches bundle.json) has 4 rows (`n_input_rows`): α = 0.35, p1 = 2.5, p2 = 4.0,10m = 120. No missing values, duplicates or out-of-range values; `data_issues` is empty and no rows were excluded11(`out/exclusions.csv`), so all 4 rows are used (`n_analysed` = 4). Audit details: `out/state/data_audit.md`.1213## Method14**Assumptions under which the closed form is the unique optimum:** 0 < α < 1, p1 > 0, p2 > 0, m > 0 (all hold here, checked in15the script). Then (i) u is strictly increasing in both goods on R²₊₊, so the budget constraint binds; (ii) u is strictly concave16(sum of strictly concave logs with positive weights), so any optimum is unique; (iii) ln x → −∞ as x → 0⁺, so the corner solutions17are never optimal and the solution is interior (the non-negativity constraints are slack); (iv) the budget set is compact, so an18optimum exists.1920**Derivation.** Lagrangian L = α ln x1 + (1−α) ln x2 + λ(m − p1x1 − p2x2). FOCs: α/x1 = λp1, (1−α)/x2 = λp2. Hence p1x1 = α/λ,21p2x2 = (1−α)/λ; summing and using the binding budget gives λ = 1/m. Therefore22x1* = αm/p1, x2* = (1−α)m/p2, v(p,m) = α ln(αm/p1) + (1−α) ln((1−α)m/p2). Implications: MRS = (α/x1)/((1−α)/x2) = p1/p2 at the23optimum, and the expenditure share of good 1 is α.2425**Numerical validation (independent of the closed form).** Implemented in `out/analysis.py`, using only u, the prices and the income:26(a) grid search over 2,000,001 points of x1 ∈ (0, m/p1) on the budget line x2 = (m − p1x1)/p2; (b) bounded Brent minimisation of −u27on the same line (xatol 1e-12); (c) 2-D SLSQP on −u with the *inequality* budget constraint and positivity bounds, started at (1,1),28which tests that the budget binds rather than imposing it. `indirect_utility_numerical` is the largest utility found across the29three. **Scope:** the validation covers only the single parameter point in `data/parameters.csv` (α = 0.35, p1 = 2.5, p2 = 4,30m = 120); the general formula is established by the derivation, not by the numerics. No randomness is used (`random_seed` = null).3132## Results33- Demand for good 1: `x1_demand` = 16.8 units; demand for good 2: `x2_demand` = 19.5 units.34- Indirect utility: `indirect_utility` = 2.9182520129 utils.35- Budget residual: `budget_identity_residual` = 0.0 currency units.36- Tangency: `mrs_at_optimum` = 0.625 = `price_ratio` = 0.625.37- Expenditure share of good 1: `expenditure_share_good1` = 0.35 (= α).38- Numerical maximum: `indirect_utility_numerical` = 2.9182520129; `utility_gap_numerical_minus_closed_form` = 0.0. Individual39 methods: `numerical_utility_grid` = 2.91825201286344, `numerical_utility_brent` = 2.91825201286353, `numerical_utility_slsqp`40 = 2.91825201286353. Numerical maximisers agree with the closed-form demands to within `max_abs_demand_gap_x1` = 9.6e-6 (set by41 grid spacing) and `max_abs_demand_gap_x2` = 4.4e-7; SLSQP's budget slack is `numerical_slsqp_budget_slack` = 2.8e-14 (budget binds).42- `feasibility` = "complete".4344## Uncertainty45This is a deterministic theoretical exercise with given parameters; there is no sampling uncertainty. The only uncertainty is46numerical: floating-point rounding (residual exactly 0.0 here) and optimiser/grid tolerance. Because utility is flat near the47optimum, demand discrepancies of order 1e-6–1e-5 (`max_abs_demand_gap_x1`, `max_abs_demand_gap_x2`) translate into utility48discrepancies at or below ~1e-13 (`numerical_utility_grid` vs `indirect_utility`).4950## Limitations and open issues51- The numerical validation covers one parameter point only; it does not by itself prove the formula for other parameters (the52 analytic derivation does, under the stated assumptions).53- The closed form is not valid outside 0 < α < 1, p1, p2, m > 0; the script stops with an error in that case rather than reporting54 values.55- The reported `indirect_utility_numerical` is the maximum over three methods; the Brent and closed-form values coincide to the last56 printed digit, so the gap reported is 0.0 at double precision.57- Extra diagnostic keys (prefixed `numerical_`, `utility_gap_…`, `max_abs_demand_gap_…`) are included in `out/results.json` beyond58 the required ones.59