You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
inventory_q: D_MAX wording inconsistent with np.arange semantics, and truncated geometric does not sum to 1 #881
While reviewing lectures/inventory_q.md as part of mirroring it into QuantEcon/lecture-dp, Copilot flagged two issues in the same code block (create_sdd_inventory_model). Both look real and worth a small follow-up here.
The comment calls `D_MAX` the demand upper bound, but `np.arange(D_MAX)` makes it an exclusive upper bound — the largest demand actually included is `D_MAX - 1` (= 20 by default).
Either tweak the wording (e.g. `# Demand upper bound (exclusive) for summation` or `# Demand support size`), or use `np.arange(D_MAX + 1)` if the inclusive reading was intended.
`(1-p)^d * p` is the geometric PMF on `d = 0, 1, 2, ...` and so `ϕ_values` over `d = 0..D_MAX-1` does not sum to 1 — the tail mass `(1-p)^{D_MAX}` is dropped. With defaults (`p = 0.7`, `D_MAX = 21`) the missing mass is `0.3^{21} ≈ 10^{-11}` — completely negligible numerically — but for smaller `p` it can become non-trivial, which would bias the Bellman expectation and the greedy policy.
One simple fix is to fold the tail into the last grid point:
Activity