# F5-dev-01 — Cobb–Douglas consumer: closed-form demands with numerical validation ## Question A consumer with u(x1,x2) = α ln x1 + (1−α) ln x2 chooses x1, x2 ≥ 0 subject to p1x1 + p2x2 ≤ m. We derive the Marshallian demands, the indirect utility and the budget residual in closed form, evaluate them at the parameters in `data/parameters.csv`, and validate them by an independent numerical maximisation of u that does not use the closed form. ## Data and exclusions `data/parameters.csv` (SHA-256 a04798ad…4722, matches bundle.json) has 4 rows (`n_input_rows`): α = 0.35, p1 = 2.5, p2 = 4.0, m = 120. No missing values, duplicates or out-of-range values; `data_issues` is empty and no rows were excluded (`out/exclusions.csv`), so all 4 rows are used (`n_analysed` = 4). Audit details: `out/state/data_audit.md`. ## Method **Assumptions under which the closed form is the unique optimum:** 0 < α < 1, p1 > 0, p2 > 0, m > 0 (all hold here, checked in the script). Then (i) u is strictly increasing in both goods on R²₊₊, so the budget constraint binds; (ii) u is strictly concave (sum of strictly concave logs with positive weights), so any optimum is unique; (iii) ln x → −∞ as x → 0⁺, so the corner solutions are never optimal and the solution is interior (the non-negativity constraints are slack); (iv) the budget set is compact, so an optimum exists. **Derivation.** Lagrangian L = α ln x1 + (1−α) ln x2 + λ(m − p1x1 − p2x2). FOCs: α/x1 = λp1, (1−α)/x2 = λp2. Hence p1x1 = α/λ, p2x2 = (1−α)/λ; summing and using the binding budget gives λ = 1/m. Therefore x1* = α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 the optimum, and the expenditure share of good 1 is α. **Numerical validation (independent of the closed form).** Implemented in `out/analysis.py`, using only u, the prices and the income: (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 −u on the same line (xatol 1e-12); (c) 2-D SLSQP on −u with the *inequality* budget constraint and positivity bounds, started at (1,1), which tests that the budget binds rather than imposing it. `indirect_utility_numerical` is the largest utility found across the three. **Scope:** the validation covers only the single parameter point in `data/parameters.csv` (α = 0.35, p1 = 2.5, p2 = 4, m = 120); the general formula is established by the derivation, not by the numerics. No randomness is used (`random_seed` = null). ## Results - Demand for good 1: `x1_demand` = 16.8 units; demand for good 2: `x2_demand` = 19.5 units. - Indirect utility: `indirect_utility` = 2.9182520129 utils. - Budget residual: `budget_identity_residual` = 0.0 currency units. - Tangency: `mrs_at_optimum` = 0.625 = `price_ratio` = 0.625. - Expenditure share of good 1: `expenditure_share_good1` = 0.35 (= α). - Numerical maximum: `indirect_utility_numerical` = 2.9182520129; `utility_gap_numerical_minus_closed_form` = 0.0. Individual methods: `numerical_utility_grid` = 2.91825201286344, `numerical_utility_brent` = 2.91825201286353, `numerical_utility_slsqp` = 2.91825201286353. Numerical maximisers agree with the closed-form demands to within `max_abs_demand_gap_x1` = 9.6e-6 (set by 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). - `feasibility` = "complete". ## Uncertainty This is a deterministic theoretical exercise with given parameters; there is no sampling uncertainty. The only uncertainty is numerical: floating-point rounding (residual exactly 0.0 here) and optimiser/grid tolerance. Because utility is flat near the optimum, demand discrepancies of order 1e-6–1e-5 (`max_abs_demand_gap_x1`, `max_abs_demand_gap_x2`) translate into utility discrepancies at or below ~1e-13 (`numerical_utility_grid` vs `indirect_utility`). ## Limitations and open issues - The numerical validation covers one parameter point only; it does not by itself prove the formula for other parameters (the analytic derivation does, under the stated assumptions). - The closed form is not valid outside 0 < α < 1, p1, p2, m > 0; the script stops with an error in that case rather than reporting values. - The reported `indirect_utility_numerical` is the maximum over three methods; the Brent and closed-form values coincide to the last printed digit, so the gap reported is 0.0 at double precision. - Extra diagnostic keys (prefixed `numerical_`, `utility_gap_…`, `max_abs_demand_gap_…`) are included in `out/results.json` beyond the required ones.