Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download

📚 The CoCalc Library - books, templates and other resources

Views: 96159
License: OTHER
Kernel: SageMath 8.6

The Price Elasticity of Demand

Notebook for the Public Finance course, UCSC, AY 2018/2019 by Duccio Gamannossi degl' Innocenti. You can find more information on the course here.

Intoduction

This notebook presents the elasticity of demand and how it can be computed in the case of a linear demand function.

Given a linear (Marshallian) demand function

var('b, a, P, Q') demand(a, b, P) = ((a/b) - ((1/b)*P)) html("Q^D="+latex(demand(a, b, P)))

Where a,b>0a, b >0 and 0≤P≤a0 \leq P \leq a to ensure positivity of quantity demanded and the negative slope of the curve

Then, the inverse demand function is:

demand_inv(a, b, Q) = solve(demand(a, b, P) == Q, P)[0].rhs() html("P^D="+latex(demand_inv(a, b, Q)))

With 0≤Q≤ab0 \leq Q \leq \frac{a}{b} to ensure positivity of price.

The slope of the demand curve is given by its derivative relative to price ∂Q∂P\frac{\partial Q}{\partial P}

dqdp=derivative(demand(a, b, P), P) html("\\frac{\partial Q}{\partial P}=" + latex(dqdp))

The price elasticity of demand is defined as the percentage change in quantity demanded in response to a one percent change in price.

ϵ=dQQdPP=dQdPPQ\epsilon=\frac{\frac{d Q}{Q}}{\frac{d P}{P}} = \frac{dQ}{dP}\frac{P}{Q}

For our demand function it is dQdP=−1b\frac{dQ}{dP}= -\frac{1}{b} and, from the inverse demand function, QD=−Pb+abQ^D=-\frac{P}{b} + \frac{a}{b}. Substituting into the elasticity expression it is

elasticity(P, a) = (dqdp*P/demand(a, b, P)).simplify_full() html("\epsilon=" + latex(elasticity(P, a)))

Given that PP ranges between 00 and aa, the elasticity is bounded between a minimum ϵ(P=0)=0\epsilon(P=0) = 0 and a supremum ϵ(P=a)→∞\epsilon(P=a) \rightarrow \infty.

We can investigate how elasticity changes in response to price by computing its derivative with respect to PP

dedp=diff(elasticity(P, a),P).simplify_full() html("\epsilon=" + latex(dedp) + "<0")

So we can conclude that for higher prices elasiticity will be smaller.

We can plot the demand curve and have a look at the variation of elasticity in response to price using an interactive graph

from sage.repl.ipython_kernel.interact import interact import matplotlib as mpl mpl.rcParams['axes.labelsize'] = 14. mpl.rcParams['xtick.labelsize'] = 14. mpl.rcParams['ytick.labelsize'] = 14. mpl.rcParams['legend.fontsize'] = 14. mpl.rcParams['figure.titlesize'] = 50. mpl.rcParams['font.size'] = 14. mpl.rcParams['font.family'] = 'serif' import numpy as np verticalPad(a, b) = demand_inv(a, b, 0)*(1/10) pmax(a, b) = demand_inv(a, b, 0) + verticalPad qmax(a, b) = a/b consumer_color = Color(.098, .447, .82) producer_color = Color(.588, .204, .518)
pmax(a) = a qmax(a, b) = a/b a=10 b=.5 @interact def _(p0 = slider(.0000001, pmax(a), step_size=pmax(a)/1000000, default = pmax(a)/2)): demand_plot = plot(demand_inv(a, b, Q), (Q, 0, qmax(a, b)), rgbcolor = (consumer_color), ticks = [[a/(2*b)], [a/2]], tick_formatter=[["$\\frac{a}{2b}$"], ["$\\frac{a}{2}$"]], axes_labels=['quantity','price'], axes_labels_size = 1) unit_h = line([(0, a/2), (a/(2*b), a/2)], color = "black", linestyle = ('--')) unit_v = line([(a/(2*b), 0), (a/(2*b),a/2)], color = "black", linestyle = ('--')) dot_plot = point((demand(a, b, p0), p0), pointsize=60, rgbcolor=(1,0,0)) P_tot = demand_plot + dot_plot + unit_h + unit_v elasticity_plot = text('$\epsilon$=%s'%(elasticity(p0, a).n(3)), (demand(a, b, p0)+1, p0+.5) , horizontal_alignment='left', color='black', fontsize = 14) midpoint_plot = text('$M$', (((a/(2*b))-1.75,(a/2)-.75)) , horizontal_alignment='left', color='black', fontsize = 18) inelastic_plot = text('Inelastic Demand $|\epsilon| < 1 $', ((a+11,(.5+a/4))) , horizontal_alignment='left', color='black', fontsize = 12) elastic_plot = text('Elastic Demand $|\epsilon| > 1 $', ((a/(4*b)+2,(2/3)*a+3)) , horizontal_alignment='left', color='black', fontsize = 12) P_tot = P_tot + elasticity_plot + midpoint_plot + inelastic_plot + elastic_plot P_tot.fontsize(15) show(P_tot, ymin = -verticalPad(a, b), ymax = pmax(a, b)+1, xmin = -1, xmax = qmax(a, b)+4.9, figsize = 7)

Given that demand is downward sloping, elasticity is always negative. By convention, economists usually report the absolute value of elasticity ∣ϵ∣|\epsilon|.

The midpoint MM where P=a/2P=a/2 is characterized by unitary elasticity, i.e., ϵ(P=a2)=1\epsilon(P=\frac{a}{2}) = 1. At this point, a 1%1\% change in price leads to a 1%1\% change in quantity. For points at the left of MM, an increase in price of 1%1\% reduce quantities by more that 1%1\% i.e., the demand is elastic. Conversely, for the points at the right of MM a 1%1\% increase in price entails a reduction in quantity of an amount lower that the 1%1\%, i.e. the demand is inelastic.

Usually, economists use the symbol ϵ\epsilon to refer to the Marshallian (uncompensated) price elasticity of demand while using the symbol η\eta for the Hicksian (compensated) price elasticity of demand.

To compute η\eta the method is exactly the same but applied to the compensated demand function.