Mathematica Problem Set 1

1.  You enjoy both movies, M, and pizza, P.  Your utility function for these two goods is:  



                          U = .6 log M + .4 log P

a) For a given quantity of pizzas, say P=2, plot your total utility function for movies.

Clear[f,M]

f[M_] = .6 Log[M ] + .4 Log[2];

Plot[f[M],{M,0,10},

    PlotRange->{0,2},

    PlotStyle->{{Red,Thickness[0.015]}},

    AxesLabel->{"Movies","U"},

    PlotLabel->"Total utility"];

b) Suppose the quantity of pizzas increases to 3, show how this would affect your total utility function.

Clear[f,f2,M]

f[M_] = .6 Log[M ] + .4 Log[2];

f2[M_] = .6 Log[M ] + .4 Log[3];

Plot[{f2[M],f[M]},{M,0,10},

    PlotRange->{0,2},

    PlotStyle->{{Blue,Thickness[0.01]},

	{Red,Thickness[0.01]}},

    AxesLabel->{"Movies","U"},

    PlotLabel->"Total utility"];

c) Graph your marginal utility functions for movies and pizza.

Plot[f'[M],{M,1,8},

    PlotStyle->{{Red,Thickness[0.015]}},

    

    AxesLabel->{"Movies","U"},

    PlotLabel->"Marginal utility of movies"]

Plot[f'[P],{P,1,8},

    PlotStyle->{{Blue,Thickness[0.015]}},

    AxesLabel->{"Pizzas","U"},

    PlotLabel->"Marginal utility of pizzas"];

d) For total utility equal to 1.27, graph the relationship between M and P, measuring M on the vertical axis and P on the horizontal axis.  This curve is called an indifference curve.

f1[P_] = Exp[(1.27 - .4 Log[P])/.6]

Plot[f1[P],{P,0,8},

    PlotRange->{0,8},

    PlotStyle->{{Blue,Thickness[0.015]}},

    AxesLabel->{"Pizza","Movies"},

    PlotLabel->"Indifference Curve"];

e) Repeat step d for utility levels 1.46 and 1.61, making an indifference map.

Clear[f2,P]

f2[P_] = Exp[(1.46 - 0.4 Log[P])/.6];

f3[P_] = Exp[(1.61 - 0.4 Log[P])/.6];

Plot[{f1[P], f2[P], f3[P]},{P,0,8},

    PlotRange->{0,10},

    PlotStyle->{{Blue,Thickness[0.01]},

	{Red,Thickness[0.01]},

	{Green,Thickness[0.01]}},

    AxesLabel->{"Pizza","Movies"},

    PlotLabel->"Indifference Map"];

2.  Supppose the price of pizza is $3 and the price of a movie is $4.  You have $25 per week to spend on pizzas and movies.  Therefore, your budget constraint is:



                           25 = 3 P + 4 M

a)  Graph your budget constraint with M on the vertical axis and P on the horizontal axis.

b1[P_] = (25 - 3 P)/4;

Plot[b1[P],{P,0,10},

    PlotRange->{0,8},

    PlotStyle->{{Blue,Thickness[0.015]}},

    AxesLabel->{"Pizza","Movies"},

    PlotLabel->"Budget Line"];

b) Increase the budget to 30 and add this new constraint.

b2[P_] = (30 - 3 P)/4;

Plot[{b1[P],b2[P]},{P,0,10},

    PlotRange->{0,8},

    PlotStyle->{{Blue,Thickness[0.01]},{Green,Thickness[0.01]}},

    AxesLabel->{"Pizza","Movies"},

    PlotLabel->"Budget Lines"];

c) Repeat step b for a budget of $35.

b3[P_] = (35 - 3 P)/4;

Plot[{b1[P],b2[P],b3[P]},{P,0,12},

    PlotRange->{0,10},

    PlotStyle->{{Blue,Thickness[0.01]},

    {Green,Thickness[0.010]},{Red,Thickness[0.01]}},

    AxesLabel->{"Pizza","Movies"},

    PlotLabel->"Budget Lines"];

3.  Add your budget lines from part 2 to your indifference map in part 1.  Are there any points of tangency?  The points of tangency are your income expansion path.

Plot[{f1[P],f2[P],f3[P],b1[P],b2[P],b3[P]},{P,0,13},

    PlotRange->{0,13},

    PlotStyle->{{Blue,Thickness[0.01]},

	{Red,Thickness[0.01]}, {Green,Thickness[0.01]},

	{Yellow,Thickness[0.01]},{Purple,Thickness[0.01]},

	{Black,Thickness[0.01]}},

    AxesLabel->{"Pizza","Movies"},

    PlotLabel->"Income Expansion Path"];

4. Suppose the price of pizza falls to $2, while your budget remains at $25 and the price of movies at $4



a.)  Graph the old and new budget lines.

b4[P_] = (25 - 2 P)/4;

Plot[{b1[P],b4[P]},{P,0,13},

    PlotRange->{0,10},

    PlotStyle->{{Blue,Thickness[0.01]},

       {Red,Thickness[0.01]}},

    AxesLabel->{"Pizza","Movies"},

    PlotLabel->"Budget Lines"];

b) Add the indifference curves for utility levels 1.27 and 1.44.  Are there points of tangency?

f4[P_] = Exp[(1.44 - .4 Log[P])/.6]

Plot[{f1[P],f4[P],b1[P],b4[P]},{P,0,13},

    PlotRange->{0,13},

    PlotStyle->{{Green,Thickness[0.01]},

       {Yellow,Thickness[0.01]},{Blue,Thickness[0.01]},

       {Red,Thickness[0.01]}},

    AxesLabel->{"Pizza","Movies"},

    PlotLabel->"Consumer Choice"];