/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ /* [ Created with wxMaxima version 12.04.0 ] */ /* [wxMaxima: input start ] */ fpprintprec:5$ ratprint:false$ load(draw)$ set_draw_defaults( fill_color=gray40, draw_realpart=false,font_size=10)$ kill(all)$ /* [wxMaxima: input end ] */ /* [wxMaxima: title start ] Preferences and Demand [wxMaxima: title end ] */ /* [wxMaxima: section start ] The CES Utility Function [wxMaxima: section end ] */ /* [wxMaxima: section start ] A Giffen Good [wxMaxima: section end ] */ /* [wxMaxima: comment start ] This section extends Chapter 4's inferior good. The utility function can represent case in which both goods are normal goods, one good is a non-Giffen inferior good, or one good is a Giffen goods, depending on the parameter values. These values produce the third case. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ u(x,y,a,b,c):=a*log(x)+b*log(y)+c*x*y; [a0,b0,c0]:[40,50,-0.1]$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] A typical indifference curve passes through four areas: * one in which both goods are normal goods, * one in which x is inferior, * one within x is a Giffen good, and * one in which the marginal utility of $x$ is negative. The graph below shows the boundary areas, given the three conditions that are defined in the next cell. All are expressions for critial values of the product x*y. Therefore, each is of the form x*y = C, where C is a condition, so y = C/x. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ [xy1,xy2,xy3]: [-a0/c0, -(b0-sqrt(b0*(b0-a0)/2))/c0, -(b0 - sqrt(b0*(b0-a0)))/c0]; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The graph shows the indifference curve for u = 230 and the boundary conditions. The first boundary curve is for y = xy1/x or y = -(a0/c0)/x. Likewise for the other two. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ wxdraw2d(user_preamble="set key bottom left", title="An indifference curve and three boundary lines", xlabel="x",ylabel="y",yrange=[0,35],key="u = 230", implicit(u(x,y,a0,b0,c0)-230,x,0.01,30,y,0.1,35), line_width=3,key="xy1:mux=0", explicit(xy1/x,x,0.1,30),line_width=2,color=black, key="xy2: Giffen",explicit(xy2/x,x,0.1,30),color=orange, key="xy3: Inferior",explicit(xy3/x,x,0.1,30))$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] As the text argues, the area to the northeast of the xy1 boundary condition will not be observed. For this complicated expression, we rely on numerical methods. A graph guides our numerical analysis. To draw the graph we require an expression for mrs that is stated in terms of x, income, the price, and the utility function's parameters. First, define the mrs function. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ mrs(x,y,a,b,c):=''(radcan(diff(u(x,y,a,b,c),x)/diff(u(x,y,a,b,c),y))); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] To remove y from the expression, substitute the budget constraint into the expression. The result is mrs_aug (augmented), which can be graphed. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ mrs_aug(a,b,c,m,x,p):=''(mrs(x,m-p*x,a,b,c)); /* For the parameters provided above */ mrs_aug(a0,b0,c0,m0,x,p); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] We can now generate our guide. Given two values of m and the utility function's parameters, we can graph mrs_aug-p values. Utility maximization requires that mrs_aug-p=0, which occurs in the range 10 < x < 25 (other endpoints could be used in this expression). [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ [m0, m1] : [22.5, 25]$ [p0, p1] : [0.2, 0.3]$ wxdraw2d(user_preamble="set key bottom left",xaxis=true, yrange=[-10,10],xlabel="x",ylabel="mrs - p",key="m0,p0", explicit(mrs_aug(a0,b0,c0,m0,x,p0)-p0,x,.11,50), line_width=2,key="m1,p0",explicit(mrs_aug(a0,b0,c0,m1,x,p0)-p0, x,.11,50),color=red,key="m0,p1", explicit(mrs_aug(a0,b0,c0,m0,x,p1)-p1,x,.11,50))$ /* [wxMaxima: input end ] */ /* [wxMaxima: subsect start ] Analyzing Consumer Behavior [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] find_root( ) is applied as follows: define a level of m and evaluate mrs_aug-p0. (The text explains how m0 and p0 are selected.) Once x0 is defined, the budget line generates y0. Values of x0 and y0 the imply utility level u0. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ [m0,m1]:[22.5,25]$ [p0,p1]:[0.2,0.3]$ x0: find_root( mrs_aug(a0,b0,c0,m0,x,p0)-p0,x,.1,25 )$ y0:m0-p0*x0$ u0:u(x0,y0,a0,b0,c0)$ matrix(["x0","y0","spending","m0", "u0"],[x0,y0,y0+p0*x0,m0,u0]); /* [wxMaxima: input end ] */ /* [wxMaxima: subsect start ] The Income Effect [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] Increasing m from m0 to m1 without changing p causes x to decrease and y to increase. The utility level increases. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ x1: find_root(mrs_aug(a0,b0,c0,m1,x,p0)-p0,x,.1,22 )$ y1: m1-p0*x1$ u1:u(x1,y1,a0,b0,c0)$ matrix( ["m","x","y","spending","u"],[m0,x0,y0,y0+p0*x0,u0], [m1,x1,y1,y1+p0*x1,u1] ); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The income elasticity of demand for the inferior good x over this range is approximately -1.2: a one percent income change causes the quantity to change by about 1.2 percent in the opposite direction. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ ((x1 - x0)/(x1 + x0)) /((m1 - m0)/(m1 + m0)); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The income elasticity of demand for the normal good y is positive, approximately 1.4. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ ((y1 - y0)/(y1 + y0)) /((m1 - m0)/(m1 + m0)); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] TeX: The graph below illusrates these results. The thin grey lines represent the initial budget line and indifference curve. The thick black lines represent the second budget line and indifference curve. The thick gray line segment that connects the optimal consumption points approximates part of the consumer's Income Consumption Curve (ICC). We truncate the y axis to emphasize the income effect. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ [xlow, xhigh]: [min(x0, x1), max(x0, x1)]$ [ylow, yhigh]: [min(y0, y1), max(y0, y1)]$ wxdraw2d( user_preamble="set key bottom left", yrange=[15,1.1*m1],xlabel="x",ylabel="y",key="u = u0", implicit(u(x, y, a0, b0, c0) - u0, x, .75*xlow,1.5*xhigh, y,0.8*ylow,1.2*yhigh), key="m = m0", explicit(m0-p0*x,x,0, 1.5*xhigh), line_width=2, color = black,key="u = u1l", implicit(u(x,y,a0,b0,c0)-u1,x,.75*xlow,1.5*xhigh, y, 0.8*ylow,1.2*yhigh),key="m = m1",explicit(m1-p0*x, x,0,1.5*xhigh),key= "ICC",color= red, line_width=3, points_joined=true, points([x0, x1], [y0, y1]), dimensions=[480,480])$ /* [wxMaxima: input end ] */ /* [wxMaxima: subsect start ] The Price Effect [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] The output below shows the effects of raising px, with m held constant at m0. The first row shows the initial values, and the second row shows that when px increases, x consumption increases and y consumption and u decrease. The uncompensated demand curve for this good slopes upward over the price range considered. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ x2: find_root(mrs_aug(a0,b0,c0,m0,x,p1)-p1,x,.1,25)$ y2:m0-p1*x2$ u2:u(x2,y2,a0,b0,c0)$ matrix( ["p","x","y","u","spending = m"],[p0,x0,y0,u0,y0+p0*x0], [p1,x2,y2,u2,y2+p1*x2]); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The upward-sloping uncompensated demand curve implies that the the price elasticity is positive. In this case the value is approximately 0.08. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ ((x2-x0)/(x2+x0))/((p1-p0)/(p1+p0)); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The next graph illustrates the effects defined above. The line segment approximates part of the Price Consumption Curve (PCC). [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ [xlow, xhigh]: [min(x0, x2), max(x0, x2)]$ [ylow, yhigh]: [min(y0, y2), max(y0, y2)]$ wxdraw2d( user_preamble="set key bottom left", xlabel = "x", ylabel = "y", key = "u = u0", line_width=2, implicit(u(x,y,a0,b0,c0)-u0, x,.75*xlow,1.5*xhigh,y, 0.8*ylow, 1.2*yhigh), key = concat("p = p0, x = ", string(x0)) , explicit(m0 - p0*x, x, 0, 1.5*xhigh), color=red, key = "u = u2", implicit(u(x, y, a0, b0, c0) - u2, x, .75*xlow, 1.5*xhigh, y, 0.8*ylow, 1.2*yhigh), key = concat("p = p1, x = ", string(x2)), explicit(m0 - p1*x, x, 0, 1.5*xhigh), key = "PCC Segment", points_joined = true, color=yellow, points([x0, x2], [y0, y2]),dimensions=[480,480] )$ /* [wxMaxima: input end ] */ /* [wxMaxima: subsect start ] Income and Substitution Effects of a Price Change [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] To determine the size of the income and substitution effects, create an augmented utility function, replacing y with m - p*x, and set that function equal to the initial utility level. Also, set mrs_aug = p2. Now, two values can vary: those of x and m. Use mnewton( ) to solve this pair of equations. The solution is bound to the name solsubeff. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ u_aug(a,b,c,m,x,p):=''(u(x,m-p*x,a,b,c))$ load(mnewton)$ solsubeff: mnewton([u_aug(a0,b0,c0,m,x,p1)=u0, mrs_aug(a0,b0,c0,m,x,p1)=p1], [x,m], [x0,m0]); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] If the consumer is returned to the initial utility level, the compensating income change must be increased from m = 22.5 to m = 24.458. At this income level, with p = p1, x = 18.997. The utility level named u3 is the same as u0. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ [x3, m3]:[rhs(solsubeff[1][1]),rhs(solsubeff[1][2])]$ u3: u_aug(a0, b0, c0, m3, x3, p1)$ y3:m3-p1*x3$ matrix(["x3","y3","m3","u3","u0"],[x3,y3,m3,u3,u0]); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The next graph depicts the substitution effect: x falls from x0 = 9.4981 to x5 = 9.3125. Reducing the income level to its initial value causes the quantity to increase by more than the decrease in quantity caused by the substitution effect, so that the net effect is to increase x. The ip_grid=[200,200] command is used to improve the definition of the graph of the implicit function. Likewise, the ip_grid_in=[10,10] command. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ [xlow,xhigh]:[min(x0,x3),max(x0,x3)]$ [ylow,yhigh]:[min(y0,y3),max(y0,y3)]$ wxdraw2d(user_preamble="set key bottom left", ip_grid= [200,200],ip_grid_in=[10,10],xlabel="x", ylabel="y",xrange=[0.9*xlow,1.1*xhigh], yrange=[0.95*ylow,1.05*yhigh], key="u0, p = p0, m = m0",point_size=1,points([[x0,y0]]), implicit(u(x,y,a0,b0,c0) -u0,x,.5*xlow,1.25*xhigh, y,.5*ylow,1.5*yhigh), key="", explicit(m0-p0*x,x,0,1.1*xhigh), color=red,line_width=2,key ="u5", key ="Budget line, p = p1", explicit(m3-p1*x,x,0,1.1*xhigh), point_type=filled_circle,points([[x3,y3]]), dimensions=[480,480])$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The table below shows the four values of x that correspond to the scenarios developed above. Values of money income appear at the left, prices appear on the top row, and the remaining cells report the quantities of x. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ matrix(["-", "-","|","p0=",p0,"p1=",p1],["--","--","--","--","--","--","--"], ["m0=",m0,"|","x0=",x0,"x2=",x2],["m1=",m1,"|","x1=",x1,"-","-"], ["m3=",m3,"|","-","-","x3=",x3] ); /* [wxMaxima: input end ] */ /* [wxMaxima: subsect start ] The Price Consumption Curve and the Income Consumption Curve [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] We first initialize the model by choosing an intial value for x and then determining initial values for y, p, m, and u. The value of y is determined by evalauating the first two boundary expressions. The expression xy1 says that x*y equals a constant, y is a constant divided by x0. Likewise for xy2. The initial value of y that we arbitrarily select lies halfway between these two boundary lines. Selecting x and y determines the marginal rate of substitution. We set p = mrs because that condition must hold if the consumer is to be at a point consistent with optimization. That is, it must hold if the point is to be one on the consumer's PCC. Likewise, we establish m by forcing a budget line with slope of -p0 through the point. Such a line must pass through the point if that point is to be a point on the ICC. Finally, given these values of x and y, we determine the implied utility level. This set of values lets us draw the graph below. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ x0:15$ y0:float((xy1/x+xy2/x)/2),x=x0$ p0:float(mrs(x0,y0,a0,b0,c0))$ m0:x0*p0+y0$ u0:float(u(x0,y0,a0,b0,c0))$ matrix( ["x0","y0","p0","m0","u0"],[x0,y0,p0,m0,u0]); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Before using these values, we define functions for the optimal values of x and y. To do this, we set the augmented mrs function equal to p, and solve for x. Observe that the first two "x = " expression in the output refer to complex numbers. Only the third is real. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ temp:solve(mrs_aug(a, b, c, m, x, p)-p, x); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The first command below extracts the right-hand side of the real expression above and assigns it the name xopt. Then an expression for yopt is derived from the budget line. The result of the second command is printed. Its relationship to the output in the cell above is apparent. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ xopt: rhs(temp[3])$ yopt : m-p*xopt; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] TeX: We now define expressions for optimal values of $x$ and $y$ in terms of the utility function's parameters and either $m$ or $p$. The first two expressions make $x$ and $y$ functions of $m$, given $p = p0$. The second two expressions make $x$ and $y$ functions of $p$, given $m = m0$. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ [xopt_p0,yopt_p0]:subst([a=a0,b=b0,c=c0,p=p0],[xopt,yopt])$ [xopt_m0,yopt_m0]:subst([a=a0,b=b0,c=c0,m=m0],[xopt,yopt])$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] TeX: \subsection{Graphing the ICC and PCC} This section develops a general representation of the effects that income change and price changes have on the quantity consumed of good $x$. The first of three graphs shows both the income consumption curve (ICC) and the price consumption curve (PCC). The second graph focuses on the ICC. The third graph focuses on the PCC. The first graph shows three sets of information. \begin{itemize} \item The first set consists of the boundary lines that define the regions over which $x$ is a normal good, then an inferior good, then a Giffen good, and finally a ``bad'' as we move to the northeast. \item The second set draws the ICC and the PCC using the four equations in the preceding input group. This pair of graphs uses parametric functions. For such functions, $x$ and $y$ are separate function of a third variable (either $m$ or $p$ here). This variable is treated as a parameter in these functions. For each value of the variable, over some range, the corresponding values of $x$ and $y$ are plotted. Thus the graph consists of a large number of points, but appears to be continuous.\footnote{The requisite number of points can vary. The command has a default value that determines how finely the curve is represented. If the resulting graph is insufficiently smooth, this value can be changed using either of two commands, \texttt{ip\_grid} or \texttt{ip\_grid\_in}. Increasing the number of values of the parameter values for which the functions are to be evaluated can slow processing appreciably.} \item The third set of commands generates the indifference curve and budget line that define the terminal point on our representation of the ICC and the PCC. The point of tangency must be on both due to the way these curves are defined. \end{itemize} [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ wxdraw2d(user_preamble="set key bottom left", yrange=[10,1.2*y0], ip_grid= [200,200], line_width=2,color=green, key="Boundary lines",explicit(xy1/x,x,0.1,1.5*x0), key ="",explicit(xy2/x,x,0.1,1.5*x0), explicit(xy3/x,x,0.1,1.5*x0),color=black,line_width=2, key = "ICC",parametric(xopt_p0, yopt_p0, m, 0.5, m0), key="PCC",color=red,parametric(xopt_m0, yopt_m0, p, p0, 5*p0),line_width = 1, key = "Indiff Curve and Budget Line", color=blue, implicit(u(x,y,a0,b0,c0)-u0,x,.1,1.5*x0,y,.1,1.5*y0), key = "",explicit(m0 - p0*x, x, 0, 1.5*x0) , dimensions = [540,480])$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The ICC slopes upward when x is a normal good (positive income elasticity) and bends backward when x is an inferior good (negative income elasticity). The PCC bends backward only when it reaches the Giffen range, where the income effect dominates the substitution effect. When x is a normal good, the income and substitution effects work together. Over the non-Giffen inferior range, the two work opposite each other, but the positive substitution effect dominates the negative income effect. Over the Giffen range the income effect dominate. Neither the ICC nor the PCC can reach the northeast boundary line as long as p > 0. [wxMaxima: comment end ] */ /* Maxima can't load/batch files which end with a comment! */ "Created with wxMaxima"$