Unformatted text preview:

Econ 561bSpring 2004Yale UniversityProf. Tony SmithHOMEWORK #10. Using whatever programming language that you choose, be sure that you can do thebasic programming exercises on p. 27 of Numerical Methods in Economics.1. Use one- and two-sided finite differences to compute approximations to the first andsecond derivatives of f(x) = sin(x4) at x = 1. Try different values for the incrementin the finite differences. Compare your answers to the correct derivatives.2. Use one- and two-sided finite differences to compute approximations to the first andsecond partial derivatives of f(x, y) = sin(x4log(y)) at (x, y) = (1, 1). Try differentvalues for the increment in the finite differences. Compare your answers to the correctderivatives.3. Write an efficient program to compute an approximation to a Jacobian matrix usingtwo-sided finite differences. Use this program to compute an approximation to theJacobian matrix off(x, y) = log(x) + y ,x2+ yx3+ y2, xey!at (x, y) = (1, 1). Compare your answer to the correct Jacobian matrix.4. Do Exercise #1 on p. 193 of Numerical Methods in Economics. Use two variations ofNewton’s method, one with analytical derivatives and one with numerical derivativesbased on two-sided finite differences. In addition, use Brent’s method as described inSection 9.3 of Numerical Recipes in Fortran. For each of the methods, keep track of thenumber of function evaluations during convergence to within a given tolerance froma given initial condition. Which method evaluates the function the fewest number oftimes?5. Two firms with differentiated products are competing in a single market. Let pibe theprice charged by firm i (i = 1, 2). Each firm chooses its price, taking the price of theother firm as given, so as to maximize its profits. In a Nash equilibrium, neither firmhas an incentive to change its price, given the price charged by the other firm. Firm 1solves:maxp1[p1y1− f(y1)]1subject to the demand curve y1= a0− a1(p1/p2) and the cost function f(y1) = c1y4/31.Similarly, firm 2 solves:maxp2[p2y2− g(y2)]subject to the demand curve y2= b0− b1(p2/p1) and the cost function g(y2) = c2y4/32.The ai’s, bi’s, and ci’s are (positive) parameters that you can set in a sensible way.(a) Derive the first-order conditions for firms 1 and 2.(b) Use numerical methods to find the (Nash) equilibrium prices (i.e., the values of p1and p2that satisfy the two first-order conditions). Us e four different methods tofind p1and p2: Gauss-Jacobi, Gauss-Seidel, fixed-point iteration, and Newton’smethod. Compare the speed of convergence for each of these methods from differ-ent initial conditions. (Hint: Two special cases may be helpful when testing yourprogram. First, if a0= b0, a1= b1, and c1= c2, then the two firms’ problemsare symmetric, so that the Nash equilibrium prices must satisfy p1= p2. Thissymmetry c ondition can be imposed in the firms’ first-order conditions. Second,if the firms’ cost functions are linear in output, then the first-order conditions arelinear in the two


View Full Document

Yale ECON 561-417 - HOMEWORK #1

Download HOMEWORK #1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view HOMEWORK #1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view HOMEWORK #1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?