Fix/horizontal supply curve#123
Merged
Merged
Conversation
- Add custom q() methods to Demand and Supply classes to handle perfectly elastic (horizontal) curves - Return np.inf at the threshold price with a warning about indeterminacy - Add warnings when creating horizontal curves to inform users of limitations - Block perfectly elastic/inelastic curves in Equilibrium constructor - Add comprehensive unit tests for horizontal curve behavior This allows horizontal curves to be created without crashing, while clearly communicating their limitations to users. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ot economic - Update warning messages to clarify np.inf is a placeholder for indeterminate quantity - Update ValueError messages to emphasize this is a software limitation, not economic theory - Make it clear the economics are valid but the implementation is incomplete 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Use np.isinf() instead of direct equality with np.inf - Filter out numpy deprecation warnings in warning tests - Check warning category to avoid false positives This should fix test failures in Python 3.9 and 3.11 builds. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The root issue was that perfectly elastic curves were calling horizontal_sum(), which tries to evaluate c.q(price) > 0. When c.q(price) returns an empty array for horizontal curves, this comparison fails with "truth value of empty array is ambiguous." Solution: Bypass horizontal_sum entirely for perfectly elastic curves since they can't be summed anyway (blind_sum explicitly rejects them). Set up minimal structure for single horizontal elements instead. This preserves all existing functionality while allowing horizontal curves to be created. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Temporary blockers to prevent errors with perfectly elastic and inelastic curves