# Revision history [back]

### The Cake Eating Problem in Sage

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})$)
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}-k_{t+2})]$)
Step 4: Maximize this updated equation and repeat until convergence.

Any help is appreciated.

### The Cake Eating Problem in Sage

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})$)$v(k_t)=ln(k_t-k_{t+1})$, the maximum here is simply where $k_{t+1}=0$ thus $v(k)=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}-k_{t+2})]$)[ln(k_{t+1}]$) Step 4: Maximize this updated equation and repeat until convergence. Any help is appreciated. ### The Cake Eating Problem in Sage 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)=ln(k_{t})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.