Question

2. (20 marks) Consider the model of Lecture Note 1, and for simplicity assume theres no go- vernment,so that g -0. For each of the following utility functions U(c,l) (we are ignoring public goods g here), verify that it satisfies the conditions (on the first and second derivatives) for strict increasingness, preference for variety, and normality of c and Next, ignoring the NNCs (i.e., the constraints that c20 and0S1), solve the household pro- blem of maximizing U subject to the budget constraint c = u (1-1) +r. Finally, recall that the NNCs are non-binding if, when we solve the households problem ignoring them, they are nonetheless satisfied. Under what conditions (if any) on the exogenous variables (ie, w, π, and any preference parameters) are the NNCs non-binding? (a) (10 marks) U(el)-1-σ + a-, where a, σ > 0 are parameters. (b) (10 marks) U(c,l)---e-, where e is the mathematical constant, and a,b>0

0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.io.FileReader;   //  Read Unicode chars from a file.
import java.io.IOException;  //  In case there's IO trouble.

//  WORDS. Iterator. Read words, represented as STRINGs, from a text file. Each
//  word is the longest possible contiguous series of alphabetic ASCII CHARs.

class Words
{
  private int           ch;      //  Last CHAR from READER, as an INT.
  private FileReader    reader;  //  Read CHARs from here.
  private StringBuilder word;    //  Last word read from READER.

//  Constructor. Initialize an instance of WORDS, so it reads words from a file
//  whose pathname is PATH. Throw an exception if we can't open PATH.

  public Words(String path)
  {
    try
    {
      reader = new FileReader(path);
      ch = reader.read();
    }
    catch (IOException ignore)
    {
      throw new IllegalArgumentException("Cannot open '" + path + "'.");
    }
  }

//  HAS NEXT. Try to read a WORD from READER, converting it to lower case as we
//  go. Test if we were successful.

  public boolean hasNext()
  {
    word = new StringBuilder();
    while (ch > 0 && ! isAlphabetic((char) ch))
    {
      read();
    }
    while (ch > 0 && isAlphabetic((char) ch))
    {
      word.append(toLower((char) ch));
      read();
    }
    return word.length() > 0;
  }

//  IS ALPHABETIC. Test if CH is an ASCII letter.

  private boolean isAlphabetic(char ch)
  {
    return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z';
  }

//  NEXT. If HAS NEXT is true, then return a WORD read from READER as a STRING.
//  Otherwise, return an undefined STRING.

  public String next()
  {
    return word.toString();
  }

//  READ. Read the next CHAR from READER. Set CH to the CHAR, represented as an
//  INT. If there are no more CHARs to be read from READER, then set CH to -1.

  private void read()
  {
    try
    {
      ch = reader.read();
    }
    catch (IOException ignore)
    {
      ch = -1;
    }
  }

//  TO LOWER. Return the lower case ASCII letter which corresponds to the ASCII
//  letter CH.

  private char toLower(char ch)
  {
    if ('a' <= ch && ch <= 'z')
    {
      return ch;
    }
    else
    {
      return (char) (ch - 'A' + 'a');
    }
  }

//  MAIN. For testing. Open a text file whose pathname is the 0th argument from
//  the command line. Read words from the file, and print them one per line.

  public static void main(String [] args)
  {
    Words words = new Words(args[0]);
    while (words.hasNext())
    {
      System.out.println("'" + words.next() + "'");
    }
  }
}
Add a comment
Know the answer?
Add Answer to:
2. (20 marks) Consider the model of Lecture Note 1, and for simplicity assume there's no...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 4. (5 marks) Consider the partial differential equation (1) for 1 € (0,2) and t >...

    4. (5 marks) Consider the partial differential equation (1) for 1 € (0,2) and t > 0, with boundary conditions u(0, 1) = 0 ur(2, 1) = 0. Which of the following are solutions to the PDE and boundary conditions? In each case explain your answer. Note that initial conditions are not given. (Hint: it is not necessary to solve the problem above. (a) -3)*** e ular, 1) = Žen sin [(---) --] ~[(---) ;-)e-(1-1) e+(1-3)*(/2°1 u(3,t) - Cu COS...

  • 1. Assume a consumer has as preference relation represented by u(c1, 2) for g E (0,...

    1. Assume a consumer has as preference relation represented by u(c1, 2) for g E (0, 1) and oo > n > 2, with x E C = Ri. Answer thefollow (x1+x2)" ing: a. Show the preference relation that this utility function induces "upper b. Show the preference relation these preferences represent are strictly C. Give another utility function that generates exactly the same behavior as level sets that are convexif U(x) is Convex for any xeX monotonic. this one....

  • 1) 2) 3) PROJECT #1 (2.5 Marks): The heat that is conducted through a body must...

    1) 2) 3) PROJECT #1 (2.5 Marks): The heat that is conducted through a body must frequently be removed by other heat transter processes. For example, the heat generated in an electronic device must be dissipated to the surroundings through convection by means of fins. Consider the one-dimensional aluminum fin (thickness t 3.0 mm, width Z 20 cm, length L) shown in Figure 1, that is exposed to a surrounding fluid at a temperature 1. The conductivity of the aluminum...

  • 1- Consider waves propagating in a vibrating quarter-circular membrane: at2 The displacement u(r,...

    1- Consider waves propagating in a vibrating quarter-circular membrane: at2 The displacement u(r, e t) is zero on the entire boundary at all times. a) Write down explicitly the three boundary conditions expressed above. b) Starting by the method of separation of variables, find the solution and show that it is given by ui (r, θ' t) = Σι Σ J1(A ct) sinde) [A, cos(JA Ct)+B, sin(vA ct)], where l is a positive even integer, and n is a positive...

  • need to solve the mathematical model to prove that we can get the equations i Q1...

    need to solve the mathematical model to prove that we can get the equations i Q1 a methematically please use only the weighted resedual and gerkins methods to prove it 1. A metal bar of length, L = 100 mm, and a constant cross-sectional area of A = 10 mm? is shown in figure Q1. The bar material has an elastic modulus, E = 200,000 N/mm2 with an applied load P at one end. The governing equation for elastostatic problems...

  • Consider the Kronig-Penney model discussed in the lectures, where the periodic potential corresponds to an array of del...

    Consider the Kronig-Penney model discussed in the lectures, where the periodic potential corresponds to an array of delta functions: However, unlike the usual model, we will take α < 0, so that we have potential wells rather than barriers. In the following, we aim to solve the time-independent Schrödinger equation 2m r (a) First consider the case where the energy E 0. Write down the general solution for ψ(z) within the interval 0 < r < a, and use the...

  • 2 Endogenous Growth Theory (5 marks) In the AK model with production function Y = AK....

    2 Endogenous Growth Theory (5 marks) In the AK model with production function Y = AK. Assume g- is fixed. The saving rate is s and the depreciate rate of capital of. = 0 and p a. What is the growth rate of capital (K) and output (Y)? b. Under what conditions can the economy experience perpetual (positive) growth? c. What is the key factor that drives the perpetual growth? Explain the intuition. (hint: compare the AK model with the...

  • i need help with c and d but explain why Question 1 (10 marks). Assembly A model consists of two 1D trusses with dimens...

    i need help with c and d but explain why Question 1 (10 marks). Assembly A model consists of two 1D trusses with dimensions as given in Figure 1. Element 1 runs angle, connecting parallel to the x-axis, connecting node 1 and 2. Element 2 is running at an node 1 and 3. Node 1 has an applied force in the negative y-direction. Node 1 can only in y-direction, while nodes 2 and 3 are fixed in both x and...

  • Answers can be more than one: VII. (12pts) Consider the following potential energy: region 1: U(X)...

    Answers can be more than one: VII. (12pts) Consider the following potential energy: region 1: U(X) = U. x < 0 region 2: U(X) = 0 0<x</ Uo region 3: U(x) = U. x>L ТЕ where U. >0. We want to consider a particle with energy E such that 0 < E<Uo. There are two possible forms for the wave function that might be used to represent the particle: (x) = 4 sin kyx+ B, coskx v(x) = 4e** +...

  • need to solve the mathematical model to prove that we can get the equations i   Q1...

    need to solve the mathematical model to prove that we can get the equations i   Q1 a methematically QI. A vertical pile is used to transfer the vertical load from the soft ground surface to the rock surface. It is assumed that the stiffness of the rock is sufficient to prevent any vertical displacement so that the lower edge of the rod may be considered as fixed. The soft ground acts on the pile along its length with a force...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT