math | assignment – 2019 – Steven Tschantz

2019 – Steven Tschantz

math | assignment – 该题目是一个常规的math的练习题目代写, 是比较有代表性的math等代写方向, 该题目是值得借鉴的assignment代写的题目

Mathematical Models in Economics

Exercises

Clear all of the symbols we will be using.
``````In[1]:=Clear [ p1, p2, q1, q2, a11, a12, a21, a22, b1, b2, mc1, mc2, profit1, profit2 ] ;
``````
As above, suppose the demands for products are 1 and 2 are linear functions given by
``````In[2]:=q1 [ p1 _ , p2 _] : = a11 * p1 + a12 * p2 + b1;
q2 [ p1 _ , p2 _] : = a21 * p1 + a22 * p2 + b2;
``````

(Set up a system of equations, given as a list, and solve for the coefficients.)

In[4]:=p1x = 50.; p2x = 40.; q1x = 100.; q2x = 120.; p1y = 55.; p2y = 40.; q1y = 80.; q2y = 130.; p1z = 50.; p2z = 45.; q1z = 105.; q2z = 100.; TableForm [{{ p1x, p2x, q1x, q2x } , { p1y, p2y, q1y, q2y } , { p1z, p2z, q1z, q2z }} , TableHeadings {{ "time x", "time y", "time z" } , { "price 1", "price 2", "demand 1", "demand 2" }}] Out[7]//TableForm= price 1 price 2 demand 1 demand 2 time x 50. 40. 100. 120. time y 55. 40. 80. 130. time z 50. 45. 105. 100.

``````In[8]:=conditions ={ q1 [ p1x, p2x ] == q1x, q2 [ p1x, p2x ] == q2x,
q1 [ p1y, p2y ] == q1y, q2 [ p1y, p2y ] == q2y, q1 [ p1z, p2z ] == q1z, q2 [ p1z, p2z ] == q2z }
Out[8]={50. a11+ 40. a12+ b1 == 100., 50. a21+ 40. a22+ b2 == 120., 55. a11+ 40. a12+ b1 == 80.,
``````
1. a21+ 40. a22+ b2 == 130., 50. a11+ 45. a12+ b1 == 105., 50. a21+ 45. a22+ b2 == 100.}
``````In[9]:=soln = Solve [ conditions, { a11, a12, a21, a22, b1, b2 }]
Out[9]={{a11 -4., a12  1., a21  2., a22 -4., b1  260., b2  180.}}
``````
``````In[10]:= { a11, a12, a21, a22, b1, b2 }={ a11, a12, a21, a22, b1, b2 }/. soln [[ 1 ]]
Out[10]={-4., 1., 2.,-4., 260., 180.}
``````

derivative of the formula with respect to the variable.)

``````In[11]:=elast11x = D [ q1 [ p1, p2 ] , p1 ]* p1  q1 [ p1, p2 ]/. { p1  p1x, p2  p2x }
Out[11]=-2.
``````
``````In[12]:=elast12x = D [ q1 [ p1, p2 ] , p2 ]* p2  q1 [ p1, p2 ]/. { p1  p1x, p2  p2x }
Out[12]=0.
``````
``````In[13]:=elast21x = D [ q2 [ p1, p2 ] , p1 ]* p1  q2 [ p1, p2 ]/. { p1  p1x, p2  p2x }
Out[13]=0.
``````
``````In[14]:=elast22x = D [ q2 [ p1, p2 ] , p2 ]* p2  q2 [ p1, p2 ]/. { p1  p1x, p2  p2x }
Out[14]=-1.
``````

products 1 and 2 (profit1[p1_,p2_]:=… and profit2[p1_,p2_]:=…).

``````In[15]:=mc1 = 25; mc2 = 15;
``````
``````In[16]:=profit1 [ p1 _ , p2 _]=  p1 - mc1 * q1 [ p1, p2 ]
``````

Out[16]=- 25 + p1260.- 4. p1+ 1. p2

``````In[17]:=profit2 [ p1 _ , p2 _]=  p2 - mc2 * q2 [ p1, p2 ]
``````

Out[17]=180.+ 2. p1- 4. p2-^15 + p2

takes this price what would firm 2 do, and then what would firm 1 respond?

``````In[18]:=p1a = 50.
``````

Out[18]=50.

``````In[19]:=p2b = p2 /. Solve [ D [ profit2 [ p1a, p2 ] , p2 ] == 0., p2 ][[ 1 ]]
``````

Out[19]=42.

``````In[20]:=p1c = p1 /. Solve [ D [ profit1 [ p1, p2b ] , p1 ] == 0., p1 ][[ 1 ]]
``````

Out[20]=50.

``````In[21]:=p2d = p2 /. Solve [ D [ profit2 [ p1c, p2 ] , p2 ] == 0., p2 ][[ 1 ]]
``````

Out[21]=42.

``````In[22]:=p1e = p1 /. Solve [ D [ profit1 [ p1, p2d ] , p1 ] == 0., p1 ][[ 1 ]]
``````

Out[22]=50.

firm 2 is doing the best it can given what firm 1 is doing.

``````In[23]:=nashsoln = Solve [{ D [ profit1 [ p1, p2 ] , p1 ] == 0, D [ profit2 [ p1, p2 ] , p2 ] == 0 } , { p1, p2 }]
``````

Out[23]={{p1 50.3226, p2 42.5806}}

``````In[24]:= { p1e, p2e }={ p1, p2 }/. nashsoln [[ 1 ]]
``````

Out[24]={50.3226, 42.5806}

maximum at p1=p1m and p2=p2m.

``````In[25]:=profit [ p1 _ , p2 _]= profit1 [ p1, p2 ]+ profit2 [ p1, p2 ]
``````

Out[25]=180.+ 2. p1- 4. p2- 15 + p2+- 25 + p1260.- 4. p1+ 1. p2

``````In[26]:=mergersoln = Solve [{ D [ profit [ p1, p2 ] , p1 ] == 0, D [ profit [ p1, p2 ] , p2 ] == 0 } , { p1, p2 }]
``````

Out[26]={{p1 59.7273, p2 49.2727}}

``````In[27]:= { p1m, p2m }={ p1, p2 }/. mergersoln [[ 1 ]]
``````

Out[27]={59.7273, 49.2727}

``````In[28]:=  p1m - p1e  p1e
``````

Out[28]=0.

``````In[29]:=  p2m - p2e  p2e
``````

Out[29]=0.