Beta
Welcome to Economics! #2 Economic Surplus
Loading description...
Fundamentals
Graph Theory
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Floating point error in random tests:
The meaning of the input is not explained. What does
5p -40
and-5p +200
mean?I haven't actually done all the expansion, but in the producer surplus calculation, we are told to use the equilibrium function, and then we still need to calculate the zero supply price. That means parsing the supply curve anyway, so depending on the equilibrium function doesn't really save any work. I could have just copied the curve parsing code .. wait, I did.
Producer surplus function does not need to depend on equilibrium function, it could just be doing its own calculations.
In the example, producers are willing to supply at negative prices. Not the most ideal example.
Rounding intermediate results. Bad practice.
Yeah, but I was wondering what should I do with these random equilibrium function that end up with endless decimal digits. So maybe I should change the kata to find only the producer surplus?
Or not have one call the other, have it do its own calculation without intermediate rounding. Is that an option?
I just removed equilibrium part and added consumer surplus. They have to find equilibrium points to answer this question anyway. Also I made constant of supply curve negative, does it solve the negative prices problem? Thanks again
This comment has been hidden.
No.
But producers are willing to supply at negative prices, which makes it not a very good example.
The linked Wikipedia page has the calculation (which also takes the zero supply price as an argument).
This comment has been hidden.