The Cake Eating Problem in Sage

asked 2020-07-19 02:16:17 -0500

EconJohn gravatar image

updated 2020-07-19 11:56:14 -0500

Im interested in running a basic cake eating problem in sage. In its recursive formulation we have to solve the following bellman equations: $$v(k_t)=ln(k_t-k_{t+1})+\beta v(k_{t+1}), \ \ \ \beta\in(0,1)$$ The algorithm for solving this problem is as follows:

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

Any help is appreciated.

edit retag flag offensive close merge delete


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 ( 2020-07-20 11:37:57 -0500 )edit
slelievre gravatar imageslelievre ( 2020-07-20 13:18:17 -0500 )edit

@jaydfox I have a video which goes through the pen and paper work on solving a planners problem here: Its pretty much the same problem for a cake eating problem except the production function changed.

EconJohn gravatar imageEconJohn ( 2020-07-20 14:15:30 -0500 )edit