Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
ECON 457 - A01
Computational Economics*
UVIC - Department of Economics
Spring Term 2021/22
Assignment 3
Due on Brightspace before 11pm March 10th 2022
Please create and submit a pdf file, making sure that it’s readable and unlocked.
The file name has to follow this template: 457 PS3 Surname Name StudentNumber.pdf
You can cooperate with other students, but no group submissions will be accepted
If you do cooperate, please list the other students’ names in the cover page
No “Photocopy”answers will be accepted
No late submissions will be accepted
NOTE: YOU MUST INCLUDE THE ASSIGNMENT COVER PAGE
(Failure to do so will entail a 5-point deduction from the grade received)
Remarks: Your answers have to be submitted in a “report” format. Relying on Jupyter is the easiest
option. The codes you developed have to be included as well in the pdf file. Devote some time to give the
graphs, plots and tables a format easy to understand. Also the way you present your answers matters for
the final grade. Even if a question is mainly technical, briefly explain what you are doing, stressing the
economic meaning of the various steps whenever possible. Being able to convey your thoughts effectively is
an asset also in real life.
Question 1: Systems of Non-Linear Equations (40 Marks)
Consider the vector-valued function f : R2 → R2 defined byf1(x, y)
f2(x, y)
=
100x(y − x2)− x+ 1
150(x2 − y)
(a) Rather than writing the code in terms of x and y, we want to use a more compact, and often more
powerful, way of thinking about these problems. In particular, we are going to rely on vectors and matrices.
Write two Python functions, say “nlfun” and “nljac”. The two Python functions should take as an input
a column vector xvec of dimension 2. This vector stores the current values of the variables x and y as the
entries xvec[0] and xvec[1], respectively.
The two Python functions should return as their respective output: i) for “nlfun”: a column vector fval
of dimension 2 that contains the value of f(.) at xvec; ii) for “nljac”: a 2-by-2 matrix fjac that contains the
Jacobian of f(.) at xvec.
Note: in “nlfun” you may want to write two formulas that compute the two entries in the vector storing
the two dependent variables (fval[0] and fval[1]); in “nljac” you may want to write four formulas, namely
the four partial derivatives that represent the Jacobian (fjac[0, 0], fjac[0, 1]...). All formulas should be
expressed in terms of the entries of the vector xvec, i.e. xvec[0] and xvec[1].
(b) Compute numerically the root of f(.) with Newton’s method. As the basis for your code, you may
want to use the “mynewton” function included in the Python notebook I distributed.
The code should have a for-loop. Inside the loop, at each iteration the code should be calling the two
Python functions you developed,“nlfun” and “nljac”, to compute the value of the function and its Jacobian.
The last operations performed in the loop should be the update of the guess, and the convergence check.
Use as initial guess the value xvec = [1.5, 1.5]. Note: please write the code without using the scipy.optimize
library, but feel free to use it to check that you are getting the right answer. This library needs two user-
specified functions that evaluate the values of f(.) and its Jacobian for the current guess. To achieve this
goal, you could use the functions “nlfun” and “nljac” that you have already developed.
*The material contained in this document is copyrighted ©, property of the University of Victoria, meant exclusively for
the use of students enrolled in ECON 457, and it cannot be shared without the author’s explicit consent.
Question 2: General Equilibrium (60 Marks)
Consider a simple endowment economy with four agents and two goods. Agent i is initially endowed
with eij units of good j and maximizes the following utility function:
Ui(x) =
2∏
j=1
x
aij
ij (1)
subject to the budget constraint
2∑
j=1
pjxij =
2∑
j=1
pjeij . (2)
Here, xij is the amount of good j consumed by agent i, pj is the market price of good j, and aij > 0 are
preference parameters.
A competitive general equilibrium for the endowment economy is a pair of relative prices, p1 and p2,
normalized to sum to one, such that all the goods markets clear and each agent maximizes utility subject to
their budget constraints.
(a) Write a Python code to compute the competitive general equilibrium for the following parameters:
(i, j) aij eij
(1,1) 0.50 2.0
(1,2) 0.50 3.0
(2,1) 0.75 1.0
(2,2) 0.25 2.0
(3,1) 0.80 4.0
(3,2) 0.20 0.0
(4,1) 0.25 0.0
(4,2) 0.75 2.0
Comment on your findings.
(b) Compute the competitive general equilibrium with these new parameters (all the others are kept the
same as in part a):
(i, j) aij eij
(4,2) 0.75 5.0
Comment on your findings.
(c) Compute the competitive general equilibrium with these new parameters (all the others are kept the
same as in part a):
(i, j) aij eij
(1,2) 0.50 0.0
(3,2) 0.20 3.0
Comment on your findings.
(d) Consider the general equilibrium allocations you have obtained in parts (a) and (c). Compute the
related utilities of the four agents. The change in endowments can be considered as a public intervention,
taxing individual 1 and redistributing the revenues to individual 3. Is this a Pareto improvement? Consider
the effect on individuals 2 and 4: are they better off or worse off, and why?