The Cake Eating Problem in Sage

asked 4 years ago

EconJohn gravatar image

updated 4 years ago

Im interested in running a basic cake eating problem in sage. In its recursive formulation we have to solve the following bellman equations: v(kt)=ln(ktkt+1)+βv(kt+1),   β(0,1)

The algorithm for solving this problem is as follows:

Step 1: Take an initial guess of v(kt+1)=0
Step 2: Solve for the maximum of v(kt) (in the first iteration this is v(kt)=ln(ktkt+1), the maximum here is simply where kt+1=0 thus v(kt)=ln(kt) )
Step 3: Using our maximum for v(kt) iterate it forward and update our bellman (in this case we have v(kt)=ln(ktkt+1)+β[ln(kt+1])
Step 4: Maximize this updated equation and repeat until convergence.

Any help is appreciated.

Preview: (hide)

Comments

Hi there. Could you provide a little more detail of what you're after? I'm not famliar with the cake eating problem, so I had to do a bit of googling to get the background needed to understand the question. As far as I can tell, you're looking at something like the example here, with A and a both set to 1 (so that the cake doesn't change size), and b set to your beta (discounted utility for eating the cake in the future):

Using the worked example in that wikipedia page, I played around with the problem. I think I have a feel for the problem, but I'm not sure quite what you're asking.

jaydfox gravatar imagejaydfox ( 4 years ago )
slelievre gravatar imageslelievre ( 4 years ago )

@jaydfox I have a video which goes through the pen and paper work on solving a planners problem here:https://www.youtube.com/watch?v=Bv_tP3GP5Qg&list=PLLAPgKPWbsiQ0Ejh-twYC3Fr8_WA9BKCc&index=4. Its pretty much the same problem for a cake eating problem except the production function changed.

EconJohn gravatar imageEconJohn ( 4 years ago )