F5-dev-01 — Cobb–Douglas consumer: closed-form demands with numerical validation
Question
A consumer with u(x1,x2) = α ln x1 + (1−α) ln x2 maximises utility subject to p1x1 + p2x2 ≤ m, x ≥ 0. We derive the Marshallian demands, the indirect utility, and the budget residual at the optimum, and validate them by a numerical constrained maximisation that does not use the closed form.
Data and exclusions
Single input data/parameters.csv (4 rows, SHA-256 a04798ad…4722, matching the bundle manifest): α = 0.35, p1 = 2.5, p2 = 4.0, m = 120 (n_input_rows). No missing values, duplicates or out-of-range values; data_issues is empty. No rows were excluded (out/exclusions.csv: 4 → 4; n_analysed = 4). These are given parameters of a theoretical exercise, not observed data.
Method
Derivation. Lagrangian L = α ln x1 + (1−α) ln x2 + λ(m − p1x1 − p2x2). FOCs: α/x1 = λp1, (1−α)/x2 = λp2. Summing p_i x_i = α/λ + (1−α)/λ = 1/λ = m gives λ = 1/m and x1* = α m / p1, x2* = (1−α) m / p2, v(p,m) = α ln(α m/p1) + (1−α) ln((1−α) m/p2).
Assumptions under which this is the unique optimum. 0 < α < 1, p1 > 0, p2 > 0, m > 0 (all hold here). Then u is strictly increasing in both goods (local non-satiation ⇒ the budget binds), strictly concave on the open positive orthant, and u → −∞ as either good → 0 (Inada-type boundary behaviour ⇒ no corner solution). The budget set is compact and convex, so a maximum exists, is interior, and is unique; the FOCs with the binding budget are necessary and sufficient. Outside these ranges (e.g. α ∈ {0,1}, non-positive prices or income) the formula does not apply; the script refuses to run in that case.
Numerical validation (independent of the closed form). Utility was maximised directly with three methods, all at the single parameter point above only: (a) bounded scalar maximisation (scipy minimize_scalar, xatol 1e-12) of u(x1, (m − p1x1)/p2) along the budget line; (b) a 2,000,001-point grid on the budget line; (c) a 2-D SLSQP with bounds x ≥ 1e-9 and the inequality budget constraint, started at an arbitrary feasible interior point. indirect_utility_numerical is the best utility found across the three. No randomness is used (random_seed = null).
Results
- x1* = 16.8 (
x1_demand), x2* = 19.5 (x2_demand). - v = 2.9182520128635305 utils (
indirect_utility). - Budget residual = 0.0 (
budget_identity_residual). - MRS at optimum = 0.625 = p1/p2 = 0.625 (
mrs_at_optimum,price_ratio): tangency holds. - Expenditure share of good 1 = 0.35 = α (
expenditure_share_good1). - Numerical maximum utility = 2.9182520128635305 (
indirect_utility_numerical), equal to the closed-form value to machine precision (numerical_validation.abs_diff_v_closed_vs_numerical= 0.0). The numerical maximisers were x1 ≈ 16.8000002 (bounded scalar), 16.79999 (grid), 16.79999 (SLSQP, converged, budget slack −5.7e-14); seenumerical_validation. feasibility= "complete".
Uncertainty
This is a deterministic theoretical exercise; there is no sampling uncertainty. The only uncertainty is numerical: the closed-form values are exact up to float64 rounding; the numerical optimisers locate x1 to within ~1e-5 (grid spacing ≈ 2.4e-5; SLSQP tolerance), while utility, being flat at the optimum, agrees to ~1e-13 or better (numerical_validation).
Limitations and open issues
- The numerical validation covers only the single parameter point (α=0.35, p1=2.5, p2=4, m=120); the general validity of the formula rests on the analytical derivation, not on the numerics.
- SLSQP initially reported non-convergence with an unattainable ftol of 1e-15; ftol was set to 1e-12 (documented in out/state/checks.md). Results do not depend on this choice since all three methods agree.
indirect_utility_numericalis defined as the maximum over three methods; at this point the bounded-scalar method reproduces the closed-form value exactly to float64 precision.