Class SupplyDemandModel
java.lang.Object
org.episteme.social.economics.models.SupplyDemandModel
Analytical tool for modeling supply and demand curves and calculating
competitive equilibrium. It provides mathematical utilities for market
efficiency analysis, including consumer/producer surplus and deadweight loss.
- Since:
- 1.0
- Version:
- 2.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionstatic RealconsumerSurplus(RealFunction demand, Real equilibriumPrice, Real equilibriumQuantity) Calculates the Consumer Surplus (CS), representing the cumulative difference between what consumers are willing to pay and the market price.static RealdeadweightLoss(RealFunction supply, RealFunction demand, Real equilibriumQuantity, Real actualQuantity) Calculates the Deadweight Loss (DWL) resulting from market inefficiencies or external interventions (e.g., price caps).static RealfindEquilibriumPrice(RealFunction supply, RealFunction demand, Real priceLow, Real priceHigh, Real tolerance) Resolves the market equilibrium price where the quantity supplied exactly equals the quantity demanded.static RealpriceElasticity(RealFunction demand, Real price, Real deltaP) Estimates the Price Elasticity of Demand (PED) at a specific price point.static RealproducerSurplus(RealFunction supply, Real equilibriumPrice, Real equilibriumQuantity) Calculates the Producer Surplus (PS), representing the cumulative difference between the market price and the price producers are willing to accept.static RealtotalWelfare(RealFunction supply, RealFunction demand, Real equilibriumPrice, Real equilibriumQuantity) Calculates the Total Social Welfare as the sum of consumer and producer surpluses.
-
Method Details
-
findEquilibriumPrice
public static Real findEquilibriumPrice(RealFunction supply, RealFunction demand, Real priceLow, Real priceHigh, Real tolerance) Resolves the market equilibrium price where the quantity supplied exactly equals the quantity demanded.- Parameters:
supply- the supply function S(p)demand- the demand function D(p)priceLow- lower bound for numerical searchpriceHigh- upper bound for numerical searchtolerance- precision limit for the solver- Returns:
- the calculated equilibrium price
-
consumerSurplus
public static Real consumerSurplus(RealFunction demand, Real equilibriumPrice, Real equilibriumQuantity) Calculates the Consumer Surplus (CS), representing the cumulative difference between what consumers are willing to pay and the market price. Formula: integral[0 to Q*] (D(q) - P*) dq- Parameters:
demand- the demand function D(q) mapping quantity to priceequilibriumPrice- (P*) the market clearing priceequilibriumQuantity- (Q*) the market clearing quantity- Returns:
- cumulative consumer surplus value
-
producerSurplus
public static Real producerSurplus(RealFunction supply, Real equilibriumPrice, Real equilibriumQuantity) Calculates the Producer Surplus (PS), representing the cumulative difference between the market price and the price producers are willing to accept. Formula: integral[0 to Q*] (P* - S(q)) dq- Parameters:
supply- the supply function S(q) mapping quantity to priceequilibriumPrice- (P*) the market clearing priceequilibriumQuantity- (Q*) the market clearing quantity- Returns:
- cumulative producer surplus value
-
totalWelfare
public static Real totalWelfare(RealFunction supply, RealFunction demand, Real equilibriumPrice, Real equilibriumQuantity) Calculates the Total Social Welfare as the sum of consumer and producer surpluses.- Parameters:
supply- supply function S(q)demand- demand function D(q)equilibriumPrice- market priceequilibriumQuantity- market quantity- Returns:
- total economic welfare
-
deadweightLoss
public static Real deadweightLoss(RealFunction supply, RealFunction demand, Real equilibriumQuantity, Real actualQuantity) Calculates the Deadweight Loss (DWL) resulting from market inefficiencies or external interventions (e.g., price caps).- Parameters:
supply- supply function S(q)demand- demand function D(q)equilibriumQuantity- (Q*) the efficient quantityactualQuantity- the actual traded quantity- Returns:
- value of lost economic efficiency (DWL)
-
priceElasticity
Estimates the Price Elasticity of Demand (PED) at a specific price point. Formula: E = (dQ/dP) * (P/Q)- Parameters:
demand- demand function D(p)price- target price pointdeltaP- increment for numerical derivative approximation- Returns:
- point elasticity value
-