Computational-Economics-0826
question 1: the demand is the sum of domestic and export demand as $q=0.5p^{-0.2}+0.5p^{-0.5}$
then given a $q=2$, there is no closed-form solution for the market-cleaing price, so we must use a numerical method for it.
Principle: Newton’s root-finding method: to solve $f(x)=0$, we can start with an initial $x(0)$, and set $x(k+1)=x(k)-f(x(k))/f’(x(k))$, until the difference is small enough.
1 | %matlab code: |
question 2: the farmers decide their planting area a by expect a value of the price p. Now the goverment has a support plan, holding the price not less than 1. the outcome is donated as q, influnced by both a and weather y, where y is flexible. then we have
$a=0.5+0.5E[max(p,1)]$
$q=ay$
$p=3-2q$
solve them and we get that
$E[p]=3-2(0.5+0.5E[max(p,1)]$
due to the interaction of max and E operators, there is also no closed-form solution.
Principle: 1)fixed point iteration: to solve a=f(a), we can guess an initial a and keep updating it. 2)gaussian quadrature: we use single points to present the continious distribution of y, because it can not be computed directly. we use two vectors with probability w and realizations y.
1 | %matlab code: |
question 3: plot the function $f(x)=1-e^{2x}$ on the interval$ [-1,1] $using a grid of evenlyspaced points 0.01 units apart.
1 | %matlab code: |
qusetion 4: we have two 3*3 matrics A=[[0,-1,2][-2,-1,4][2,7,-3]] and B=[[-7,1,1][7,-3,-2][3,5,0]] and the vertical vector
$y=
[3;
-1;
2].$
1)formulate the standard matrix product C=A*B and solve the linear equation Cx=y. What are the values of C and x?
1 | %matlab code: |