• Tidak ada hasil yang ditemukan

Problem Set 1

N/A
N/A
Protected

Academic year: 2024

Membagikan "Problem Set 1"

Copied!
8
0
0

Teks penuh

(1)

Problem Set

1

1. (Fractions) Write a program to find the value of 1 + 12 + 13 +...+10001 .

2. (Double sum) Write a program to find the value of 1 + (1 + 2) + (1 + 2 + 3) + (1 + 2 + 3 + 4) +...+ (1 + 2 + 3 +..+ 100).

3. (Gcd) Write a function f(x,y) that return the greatest common divisor of x and y.

For example, f(10,15) = 5 and f(21,14) = 7.

4. (Prime seek) Write a program to print all primes between 100 to 200.

5. (Binary) For any integer x such that 0< x <1024 , write a function f(x) to convert x to a based-2 number. For example, f(10) = 1010 and f(15) = 1111.

6. (Fibonacci) Define F as the following: F(0) = 1, F(1) = 2, F(x) = F(x-1) + F(x-2) for x∈ {2,4,5, ...}. Write a program to find the value of F(20).

7. (Digit Reversal) For any integer x ∈ [1111, 9999], write a function f that reverses all digits of a number. For example, f(123) = 321 and f(1345)=5431.

8. (Perfect Number) A perfect number is defined as an integer which is the sum of its proper positive divisors, that is, the sum of the positive divisors not including the number. For example, 6 is a perfect number because 6 = 1+2+3. Write a program to find all the perfect numbers between 1 and 1000.

9. (Solow 1) Consider following Solow’s model with yt = ktθ, kt+1 = (1−d)kt+s.yt k1 = 1 The term tdenote a time period. The value of each parameter is as follows:

θ = 0.6,d= 0.1,s= 0.05. In periodt= 1000, the saving rate increases permanently to 10 percent. Simulate the economy and show how the change will affect the growth rate in the short run and the long run.

10. (Matching Problem) There is an economy with 5 men: M1, M2, ..., M5 and 6 women:

W1, W2, ..., W6. You are the social planner. Your role is to arrange marriages for your citizens. Polygamy is forbidden in this economy. The output created by a couple (Mi, Wj) is (i+j)2. The output of the economy is the sum of the output of all couples. A single cannot create output. How would you arrange marriages to maximize the economy’s output? ( Note: this question is motivated by the seminal paper of the Nobel Laureate Gary Becker on Theory of Marriage. )

11. (More money; no solution) SEND + MORE = MONEY is a classical “crypto- arithmetic” puzzle: the variables S, E, N, D, M, O, R, Y represent different digits between 0 and 9, and the task is to write a program to find values for then such that the following arithmetic operation is correct: SEND + MORE = MONEY.

For example, S=1, E=2, N=3, D=4, M=5, O=6, R=7 and Y=8 are not correct because 1234 + 56716= 56328.

12. (Factorial) Write a factorial function. For example, fac(5) = 5*4*3*2*1 = 120, fac(3) = 3*2*1 = 6.

1The solution of most (but not all) problems is available on website.

(2)

13. (153) A mathematician is very surprised to find that 153 = 13+ 53 + 33. Is there any other number between 100 and 999 that has the same property?

14. (Poor ant) An ant is on the top of a pyramid in which all faces are triangles and the length of each edge is 1 centimeter. (See the picture on the board in front of the class room.) The ant starts jogging on theedges of the pyramid. The ant only runs forward not backward. When the ant passes a vertex of the pyramid, it decides randomly which is the next direction to go. On average, how long (in centimeter) does the ant has to run until it return to the top of the pyramid? You don’t have to count the first vertex and the last vertex that the ant visits.

15. (Solow 2) Consider following Solow’s model with stochastic saving rates with yt = ktθ,kt+1 = (1−d)kt+st.yt andk1 = 1. The termt denotes a time period. The value of each parameter is as follows: θ = 0.6,d= 0.1. st is uniformly distributed in [0.1, 0.2]. Calculate, numerically, the normalized S.D.2 of output and capital stock of the economy in periods 1000 - 2000. Is output or capital stock more volatile?

16. (Dice) Write a program to solve the following problem numerically. On average how many times do you need to role a dice until all the six faces show up?

17. (Lines in a square) LetA, B, C andDare random points on the perimeter of a unit square. Use the Monte-Carlo method to find the probability that lineAB and line CD intersect.

18. (Central Limit Theorem (CLT)) How accurate is the central limit theorem? : Sup- pose you roll a fair dice 50 times. What is the probability that the average of all the numbers you get is more than 3.55?

- Use a Monte-Carlo simulation to find the answer.

- Use the central limit theorem to find the answer. Calculate the difference between the two answers.

19. (Hypothesis Test)xi is uniformly distributed in [1, 2]; yi =a.xi+ei. ei is uniformly distributed between [-1, 1]. Suppose a researcher samples 10 pairs of (xi, yi). The researcher knows that yi = a.xi +ei but he does not know the true value of a.

He estimates a by using the following estimator: ˆa = P

i

yi/P

i

xi. The researcher wants to perform the hypothesis whethera= 10. His test procedure is to reject the hypothesis if |ˆa−10|> k and accept the hypothesis otherwise.

- Suppose the true value of a= 10. Find the variance of the estimator ˆa.

- Supposek = 0.05. Find the type-1 error of his hypothesis test.

20. (Risk) Consider an economic agent with utility function u(m) =mθ

wherem is his income andθ is a parameter in [0, 2]. Suppose the agent can choose between the following two income schemes:

2Normalized S.D. ofxis S.D. ofxdivided by the mean ofx.

(3)

a) ma is normally distributed with mean = 10 and variance = 1.

b) mb is normally distributed with mean = 9.95 and variance = 4.

Find the range of θ in which the agent prefers income schememb to ma, using grid search technique with grid size = 0.01. Hint: you need to find the range of θ in which E[u(mb)]> E[u(ma)].

21. (Root Finding) Find the solution of the following equation: xx = 3 for x ∈ [1,2]

using the 3 following techniques: grid search, bracketing, Newton’s method.

22. (Newron2d) Solve the following system of equations: x2+y2+ 1/x= 20, xy = 1 by Newton’s method. Use (2, 2) to be the initial point.

23. (Utility Maximization) Consider the following consumer’s optimization problem:

maxx,y xa+ya subject to x+ 2y= 1 Plot the value of x that solves the optimization problem and a for a ∈ {0.1,0.2,0.3, ...,2}. Explain the intuition behind the graph you plot.

24. (Anticipation and Policy Changes) Consider the following 50-period optimization problem:

cmaxt,kt+1

50

X

t=1

βtu(ct) subject to

ct+it+gt≤f(kt) kt+1 ≤(1−d)kt+it

Suppose u(ct) = ln(ct), d = 0.1, β = 0.95, f(kt) = kt1/2, k1 = 0.1. The term gt is government spending.

– i) Suppose the government spending gt = 0 forever. Plot the consumption path of the economy under this scenario.

– ii) Unanticipated Policy Changes 1: In the beginning of 1, the government announces that its fiscal policy would be gt = 0 forever. The government follows the policygt= 0 until period 29. However, in the beginning of period 30, the government announces a permanent policy change and switch togt = 1.

After the announcement, gt = 1 forever. Plot the consumption path of the economy under this scenario.

– iii) Anticipated Policy Changes: In the beginning of period 1, the government announces that its fiscal policy would begt= 1 ift >= 30 andgt= 0 otherwise.

Plot the consumption path of the economy under this scenario.3

– iv) Compare the consumption path in 4.1 - 4.4 and explain the similarities and difference.

25. (2-period stochastic model) Consider the following T-period optimization problem:

cmaxt,kt+1

T

X

t=1

βtE1[u(ct)]

3In this economy, the government is benevolent and never liesintentionally.

(4)

subject to

ct+it≤f(kt) kt+1 ≤(1−d)kt+it

Note that the Euler equation for this optimization is

u0(ct) = βEt[u0(ct+1)(1 +f0(kt+1)−d)]. Suppose u(ct) = ln(ct), d= 0.1, β= 0.95, f(kt) =atkt1/2, k1 = 0.1.

The termat is the productivity shock in periodt realized in the beginning of period t. Find the maximum expected lifetime utility of the economic agent under the following scenario:

i) T = 2, a1 is always 1. prob(a2 = 1) =prob(a2 = 2) = 0.5.

ii) T = 2, a1 is always 1. a2 is normally distributed with mean = 5 and variance

=1.

26. (Non-concavity) Consider the following 2-period optimization problem:

cmaxt,kt+1

2

X

t=1

βtu(ct) subject to

ct+it≤f(kt) kt+1 ≤(1−d)kt+it.

Suppose u(ct) = c3t, d= 0.1, β= 0.95, f(kt) =k0.9t , k1 = 0.1.

- Find the optimal values of c1, c2.

27. (Preference Shocks: No Solution) Consider the following problem

cmaxt,kt+1

X

t=1

0.9tu(ct) subject to

ct+kt+1 ≤k1/2t

k1 is given. Supposeu(ct) =γtln(ct).The preference shocksγt follows the following process:

ˆ

γt+1 = 0.75ˆγt+t+1

where t is uniformly distributed between [-0.1, 0.1] and the steady state value of γt is 1.

i) Solve for the steady state values of kt, ct.

ii) Log-linearizing the Euler equation and the resource constraint to get the sys- tem in form Et[Xt+1] =WXt, whereXt = [ˆcttˆγt]0

iii) Solve for ˆct as a function of the state variables: ˆkt, ˆγt.

(5)

iv) Impulse Response and Monte-Carlo Simulation: Plot the impulse response of ˆ

ct and ˆyt to t with size 0.1. Find the variance of ˆct and ˆyt caused by the preference shocksγt, whereyt is the economy’s output.

28. (Fiscal and Productivity Shocks) Consider the following problem

cmaxt,kt+1

X

t=0

βtu(ct) subject to

ct+it+gt≤f(kt) kt+1 ≤(1−d)kt+it

k0 are given. Suppose u(ct) = ln(ct), f(kt) = atkαt, gt is the government spending and is set exogenously by the government. at and gt follows the following process:

ˆ

at+1 = 0.65ˆat+a,t+1, gˆt+1 = 0.65ˆgt+g,t+14

a,t and g,t are i.i.d and normally distributed with zero mean and variance = 0.02.

i) Let a = 1 and g be the level of government spending in the steady state.

Solve for the steady state value ofkt, ct as function of parameter values andg and a (the value of government spending in the steady state).

ii) Parameterization: The data from the Thai economy indicates that the depre- ciation rate is 5 percent per year. The share of income paid to capital to the total output is equal to 66 percent. The annual interest rate is 5 percent. The Thai government spending is about 10 percent of output. Find the values of α, β, d, and g that match the model with the data.

iii) Log-linearizing the Euler equation and the resource constraint to get the sys- tem in the following matrix form:

Et[xt+1] =Wxt wherext= [ˆctˆktˆatˆgt]0

iv) Solve for ˆct as a function of ˆkt, ˆat and ˆgt.

vi) Monte-Carlo Simulation: find the variation in yt that caused by these two shocks together.

29. (Small Open Economy) This question is to be done purely analytically. No linearl- ization, no programming required. Consider the following problem:

cmaxt,ft+1

P

t=1

βtE1[u(ct)]

s.t ft+1≤(1 +r)ft+yt−ct, f1 = 0.

where ut = αctγ2c2t, ft is the stock of foreign asset holding. Assuming that α is very large and γ is a very small positive number. yt is economy output which follows an i.i.d. exogenous process: prob(yt = 0) = prob(yt = 1) = 1/2. Note that β = 0.9 and the world interest rater = 1/β−1.

4xˆtxtx−x andx is the steady state value ofx. The process ofatandgtcan actually be estimated from the data of the Thai economy.

(6)

i) Find the Euler equation and the traversality condition. Interpret the meaning of the traversality condition.

ii) Solve for the ct as a function of yt and ft.

iii) Is the steady state of the economy unique? Explain.

iv) Can you still solve the problem easily ifut=ln(ct)? Why or why not? Discuss.

30. (Fixed Point) Find the fixed point of the following functionf(x) =x2using iteration method. Usex = 0.5 to be the initial point.

31. (Functional Equation 1) Numerically solve the functional equation using iteration:

V(x) =x+ 0.1V(1−x) forx∈[0,1] using 11 grids. Then plot functionV(x). Can you analytically find V(x)?

32. (Functional Equation 2) Numerically solve the functional equation using iteration:

V(x, y) =x∗y+ 0.1V(y, x) for (x, y)∈[0,1]2 using 11x11 grids. Then plot function V(x, y). You may need to use a command for 3 dimensional plot.

33. (Simple Dynamic Programming) Consider the following problem

{ct,kmaxt+1}t=1

X

t=1

0.95tln(ct) subject to

kt+1 ≤0.9kt+k0.66t −ct

k1 is given. Suppose at period 1, the level of the capital is at 95 percent of its steady state value. Solve the optimization problem using numerical dynamic programming approach. Then plot the value functionV and the time path of consumption share over output of this economy.

34. (Learning Monopoly) Solve the following problem using numerical dynamic pro- gramming approach and plot the time path of qt.

{qmaxt}t=0

X

t=1

0.75t((1−qt)qt−ctqt) s.t.

ct+1 = 1

1 + 10qt, q0 = 0 Then solve the optimal time path for qt in case that

ct+1= 1

1 +qt, q0 = 0 . How the results in the two cases are different? Why?

35. (Simple Markov) Consider the following problem

{ct,kmaxt+1}t=1

X

t=1

0.95tln(ct) subject to

kt+1 ≤0.9kt+Atk0.66t −ct

(7)

where k1 is given, At ∈ {A1, A2, A3}, A1 = 0.99, A2 = 1.00, A3 = 1.01. The transition matrix is

Π =

0.3 0.4 ? 0.5 0 0.5 0.4 0.4 0.2

where Πij = prob(At+1 = Aj|At = Ai). What is the missing number? Assuming that the economy start from the steady state in which At = 1. Use Monte-Carlo simulation to find the correlation of consumption in period t and consumption in period t+ 1.

36. (Tree Cutting) Consider a farmer problem on when to cut a tree. If he cuts a tree with height h and sells it he will get h baht. After he cut a tree, he can plant a new tree with height 0 with no cost. The growth function of the tree is ht+1 ={1 + 10ht}α. The farmer’s dynamic programming problem is

V(ht) = max

cut,notcut{βV({1 + 10ht}α), h+βV(0)}

Consider the case thatβ =α= 0.9 and find the optimal policy rule for cutting the tree using numerical dynamic programming. Then consider the case that β =α= 0.5. In such case, can you find the optimal policy rule analytically.

37. (Dice Gambling) Consider the following gambling game. The gambler tosses a fair dice. After tossing the dice, the gambler has two choices: continues playing the game or stops. If the gambler stops the game, he will get money in baht equal to the number shown on the last dice he tossed. If he continues, he has to pay 0.5 baht, then roll the dice again to get a new number. And so on. Assume that the discount factor is 1 and formulate the problem as a dynamic programming problem.

Write down the Bellman equation. Then use numerical dynamic programming to find the optimal rule for stop playing.

38. (Auction) Consider a first-priced auction game with two bidders: 1 and 2. Bidder i submits a sealed bid bi. If bi > bj, bidder i gets the auctioned good. The payoff of agents i when getting the good isvi−bi, where vi is hisprivate valuation of the good. vi is uniformly distributed between [0,1]. Find the symmetric Bayes-Nash equilibrium of this game. Hint: 1) You don’t need calculus for this question and 2) if bi is the bidding function in the Nash equilibrium, then bi =bj and

bi(vi) = max

x

h(vi−x)prob(x > bj(vj))i.

39. (Leisure) Consider the following dynamic macroeconomic problem with leisure and work

{cmaxt,lt}

X

t=1

βt(lnct+ ln(lt))

subject to kt+1 = (1−d)kt+qkt(1−lt)−ct Note that this problem is equivalent to the following problem

V(k) = max

c,n,k/

{ln(c) + ln(1−n) +βV(k/)}

(8)

subject to k/ = (1−d)k+qk(1−l)−c

where ct is consumption, kt is capital, lt is leisure and 1−lt is working hours. The value of each parameter are the following: β = 0.9 and d= 0.1.

Possible value of working hours are discrete; the possible values oflt are 14,24 and 34. i) Use numerical dynamic program to solve for V(k). Then plot the graph of V(k). Use 101 grid points and the upper bound of V is ¯k = 4(1+βd−β)β2 2 and the lower bound is ¯k/100. (Note: You don’t need to solve for the steady state of the model.) Then plot the graph of V(k).

ii) Suppose the economy start from k1 = ¯k/100. Simulate the time path of working hours nt of this economy. Interpret the graph you get.

40. (Dynamic Cournot) This question is about a dynamic Cournot model with learning externality. The setting is as follows. There are two firms in the market: firms 1 and firms 2. The objective function of firm i is to maximize its lifetime profit:

{qmax1t}t=0

X

t=1

0.75t((10−q1t−q2t)qit−citqit) s.t.

cit+1 = 1

1 +q1t+q2t, qi0 = 0,{qjt}t=0 is given

whereqit is quantity that firmiproduces in periodt. You are asked to find the time path of q1 in a (Nash) equilibrium of the game. You may restrict attention on a symmetric Markov equilibrium in which in which qit only depends on q1t−1+q2t−1.

Referensi

Dokumen terkait

It is a learning approach that uses the real problems as context approach for students to learn how to have critical thinking and competent to solve problem are, and to get

In this project, evaluation study on dynamic analysis of automotive brake system was carried out using numerical approach.. The purpose of this particular project is to

The objective of this paper is to propose an insertion heuristic approach to solve a single row layout problem in which the machine sizes are not equal, and therefore,

In many cases, back analyses of underground excavations instabilities using numerical modelling have been widely used to estimate the rock mass long-term strength. In this approach

An enhanced bee swarm optimization method is proposed in [16]to solve the dynamic economic dispatch problem of thermal units considering the valve-point effects, ramp-rate limits, and

PBL becomes better if it is associated with the approach Higher Order Thinking HOTbecause the estuary of higher-order thinking patterns is able to solve problems From the observations

Notification Mechanism uatsoase T •v Object CoBecbon Database Objects Figure 1: Architecture for OASIS Dynamic Collections OASIS Dynamic Collections solve the problem of static

In this paper, we present the estimation for three missing data cases in strip plot design with the fixed model using the Yates approach and show the biased treatment mean square