Application Center - Maplesoft

App Preview:

Cake Eating in Finite and Infinite Time

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

 

 

 

Cake Eating in Finite and Infinite Time 

 

 

The following was implemented in Maple by Marcus Davidsson (2008) davidsson_marcus@hotmail.com 

 

and is based upon the work by Adamek (2006) The Cake-Eating Problem 

 

 

 

 

 

1) Cake Eating in Finite Time  

 

 

 

Introduction 

 

 

restart 

 

 

We assume that we have a cake that in the first period has a size of  CS(1) 

 

CS(1) 

CS(1) (1)
 

 

We now assume that we have five time periods. We assume that we consume a fraction of the cake in each time period denoted by C(1), C(2), C(3), C(4).  

 

Note that we assume that the cake is completly gone in the fifth time period which means that our consumption in period five is zero 

 

The equation of motion for the cake size in each periods are given by 

 

 

CS(2) = `+`(CS(1), `-`(C(1))) 

 

CS(3) = `+`(CS(2), `-`(C(2))) 

 

CS(4) = `+`(CS(3), `-`(C(3))) 

 

 

 

 

We will now derive the expressions for consumption in the four periods 

 

 

 

Period-1 

 

 

The cake size in the last period is given by 

 

CS(5) = `+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3)), `-`(C(4))) 

CS(5) = `+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3)), `-`(C(4))) (2)
 

 

where C(1), C(2), C(3) and C(4) are the amount of consumtion in each period 

 

We again assume that all cake is gone in the last period which means that CS(5)=0.  

 

If we plug this into the previous equation then we get the expression for the terminal condition in period one 

 

0 = `+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3)), `-`(C(4))) 

0 = `+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3)), `-`(C(4))) (3)
 

 

We can now express this equation in C(1) terms only.  

 

C(2) = `*`(B, `*`(C(1))); -1 

 

 

 

`:=`(C(4), `and`(`*`(B, `*`(C(3))) = `*`(`*`(B, `*`(`^`(B, 2))), `*`(C(1))), `*`(`*`(B, `*`(`^`(B, 2))), `*`(C(1))) = `*`(`^`(B, 3), `*`(C(1))))) 

 

 

Note that we discount consumption over time where B^t is a discount factor. Note that B=1/(1+r) where r is the interest rate.  

 

Note that since B^t < 1 it means that consumption will be decreasing over time 

 

 

If we plug the all the rewritten expressions into the previous equation we get 

 

0 = `+`(CS(1), `-`(C(1)), `-`(`*`(B, `*`(C(1)))), `-`(`*`(`^`(B, 2), `*`(C(1)))), `-`(`*`(`^`(B, 3), `*`(C(1))))) 

0 = `+`(CS(1), `-`(C(1)), `-`(`*`(B, `*`(C(1)))), `-`(`*`(`^`(B, 2), `*`(C(1)))), `-`(`*`(`^`(B, 3), `*`(C(1))))) (4)
 

We now solve for CS(1) 

 

`:=`(X, isolate(%, CS(1))) 

CS(1) = `+`(C(1), `*`(B, `*`(C(1))), `*`(`^`(B, 2), `*`(C(1))), `*`(`^`(B, 3), `*`(C(1)))) (5)
 

 

We now note that 

 

 

 

We know that 

X 

CS(1) = `+`(C(1), `*`(B, `*`(C(1))), `*`(`^`(B, 2), `*`(C(1))), `*`(`^`(B, 3), `*`(C(1)))) (6)
 

 

We now multiply both sides by B so we get 

 

`*`(B, `*`(lhs(%))) = `*`(B, `*`(rhs(%))) 

`*`(B, `*`(CS(1))) = `*`(B, `*`(`+`(C(1), `*`(B, `*`(C(1))), `*`(`^`(B, 2), `*`(C(1))), `*`(`^`(B, 3), `*`(C(1)))))) (7)
 

Which can be written as 

 

`:=`(Y, expand(%)) 

`*`(B, `*`(CS(1))) = `+`(`*`(B, `*`(C(1))), `*`(`^`(B, 2), `*`(C(1))), `*`(`^`(B, 3), `*`(C(1))), `*`(`^`(B, 4), `*`(C(1)))) (8)
 

 

 

 

Now we know that X and Y are given by 

 

X 

CS(1) = `+`(C(1), `*`(B, `*`(C(1))), `*`(`^`(B, 2), `*`(C(1))), `*`(`^`(B, 3), `*`(C(1)))) (9)
 

Y 

`*`(B, `*`(CS(1))) = `+`(`*`(B, `*`(C(1))), `*`(`^`(B, 2), `*`(C(1))), `*`(`^`(B, 3), `*`(C(1))), `*`(`^`(B, 4), `*`(C(1)))) (10)
 

 

We now subtract BCS(initial) from both sides of CS(initial) so we get 

 

`+`(lhs(X), `-`(lhs(Y))) = `+`(rhs(X), `-`(rhs(Y))) 

`+`(CS(1), `-`(`*`(B, `*`(CS(1))))) = `+`(C(1), `-`(`*`(`^`(B, 4), `*`(C(1))))) (11)
 

 

 

Which can be written as 

 

collect(%, CS(1)) 

`*`(`+`(1, `-`(B)), `*`(CS(1))) = `+`(C(1), `-`(`*`(`^`(B, 4), `*`(C(1))))) (12)
 

We now divide both sides by (1-B) so we get 

 

`/`(`*`(lhs(%)), `*`(`+`(1, `-`(B)))) = `/`(`*`(rhs(%)), `*`(`+`(1, `-`(B)))) 

CS(1) = `/`(`*`(`+`(C(1), `-`(`*`(`^`(B, 4), `*`(C(1)))))), `*`(`+`(1, `-`(B)))) (13)
 

We can now solve for C(1) 

 

isolate(%, C(1)) 

C(1) = `/`(`*`(CS(1), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 4)))))) (14)
 

 

Which is the expression for the optimal consumtion in period one 

 

 

 

 

Period-2 

 

 

Our terminal condition for period two is given by 

 

0 = `+`(CS(2), `-`(C(2)), `-`(C(3)), `-`(C(4))) 

0 = `+`(CS(2), `-`(C(2)), `-`(C(3)), `-`(C(4))) (15)
 

 

We can now express this equation in C(2) terms only.  

 

 

`:=`(C(3), `*`(B, `*`(C(2)))) 

 

`:=`(C(4), `and`(`*`(B, `*`(C(3))) = `*`(`*`(B, B), `*`(C(2))), `*`(`*`(B, B), `*`(C(2))) = `*`(`^`(B, 2), `*`(C(2))))) 

 

 

If we plug that into the previous equation we get 

 

0 = `+`(CS(2), `-`(C(2)), `-`(`*`(B, `*`(C(2)))), `-`(`*`(`^`(B, 2), `*`(C(2))))) 

0 = `+`(CS(2), `-`(C(2)), `-`(`*`(B, `*`(C(2)))), `-`(`*`(`^`(B, 2), `*`(C(2))))) (16)
 

 

We now solve for CS(2) 

 

`:=`(X, isolate(%, CS(2))) 

CS(2) = `+`(C(2), `*`(B, `*`(C(2))), `*`(`^`(B, 2), `*`(C(2)))) (17)
 

 

We now note that 

 

 

 

We know that 

X 

CS(2) = `+`(C(2), `*`(B, `*`(C(2))), `*`(`^`(B, 2), `*`(C(2)))) (18)
 

 

We now multiply both sides by B so we get 

 

`*`(B, `*`(lhs(%))) = `*`(B, `*`(rhs(%))) 

`*`(B, `*`(CS(2))) = `*`(B, `*`(`+`(C(2), `*`(B, `*`(C(2))), `*`(`^`(B, 2), `*`(C(2)))))) (19)
 

Which can be written as 

 

`:=`(Y, expand(%)) 

`*`(B, `*`(CS(2))) = `+`(`*`(B, `*`(C(2))), `*`(`^`(B, 2), `*`(C(2))), `*`(`^`(B, 3), `*`(C(2)))) (20)
 

 

 

 

Now we know that X and Y are given by 

 

X 

CS(2) = `+`(C(2), `*`(B, `*`(C(2))), `*`(`^`(B, 2), `*`(C(2)))) (21)
 

Y 

`*`(B, `*`(CS(2))) = `+`(`*`(B, `*`(C(2))), `*`(`^`(B, 2), `*`(C(2))), `*`(`^`(B, 3), `*`(C(2)))) (22)
 

 

We now subtract BCS(2) from both sides of CS(2) so we get 

 

`+`(lhs(X), `-`(lhs(Y))) = `+`(rhs(X), `-`(rhs(Y))) 

`+`(CS(2), `-`(`*`(B, `*`(CS(2))))) = `+`(C(2), `-`(`*`(`^`(B, 3), `*`(C(2))))) (23)
 

 

 

Which can be written as 

 

collect(%, CS(2)) 

`*`(`+`(1, `-`(B)), `*`(CS(2))) = `+`(C(2), `-`(`*`(`^`(B, 3), `*`(C(2))))) (24)
 

We now divide both sides by (1-B) so we get 

 

`/`(`*`(lhs(%)), `*`(`+`(1, `-`(B)))) = `/`(`*`(rhs(%)), `*`(`+`(1, `-`(B)))) 

CS(2) = `/`(`*`(`+`(C(2), `-`(`*`(`^`(B, 3), `*`(C(2)))))), `*`(`+`(1, `-`(B)))) (25)
 

We can now solve for C(2) 

 

isolate(%, C(2)) 

C(2) = `/`(`*`(CS(2), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 3)))))) (26)
 

 

Which is the expression for the optimal consumtion in period two 

 

 

 

 

Period-3 

 

 

Our terminal condition for period three is given by 

 

0 = `+`(CS(3), `-`(C(3)), `-`(C(4))) 

0 = `+`(CS(2), `-`(C(2)), `-`(C(3)), `-`(C(4))) (27)
 

 

We can now express this equation in C(3) terms only.  

 

`:=`(C(4), `*`(B, `*`(C(3)))) 

 

 

If we plug that into the previous equation we get 

 

0 = `+`(CS(3), `-`(C(3)), `-`(`*`(B, `*`(C(3))))) 

0 = `+`(CS(3), `-`(C(3)), `-`(`*`(B, `*`(C(3))))) (28)
 

 

We now solve for CS(3) 

 

`:=`(X, isolate(%, CS(3))) 

CS(3) = `+`(C(3), `*`(B, `*`(C(3)))) (29)
 

 

We now note that 

 

 

 

We know that 

X 

CS(3) = `+`(C(3), `*`(B, `*`(C(3)))) (30)
 

 

We now multiply both sides by B so we get 

 

`*`(B, `*`(lhs(%))) = `*`(B, `*`(rhs(%))) 

`*`(B, `*`(CS(3))) = `*`(B, `*`(`+`(C(3), `*`(B, `*`(C(3)))))) (31)
 

Which can be written as 

 

`:=`(Y, expand(%)) 

`*`(B, `*`(CS(3))) = `+`(`*`(B, `*`(C(3))), `*`(`^`(B, 2), `*`(C(3)))) (32)
 

 

 

 

Now we know that X and Y are given by 

 

X 

CS(3) = `+`(C(3), `*`(B, `*`(C(3)))) (33)
 

Y 

`*`(B, `*`(CS(3))) = `+`(`*`(B, `*`(C(3))), `*`(`^`(B, 2), `*`(C(3)))) (34)
 

 

We now subtract BCS(3) from both sides of CS(3) so we get 

 

`+`(lhs(X), `-`(lhs(Y))) = `+`(rhs(X), `-`(rhs(Y))) 

`+`(CS(3), `-`(`*`(B, `*`(CS(3))))) = `+`(C(3), `-`(`*`(`^`(B, 2), `*`(C(3))))) (35)
 

 

 

Which can be written as 

 

collect(%, CS(3)) 

`*`(`+`(1, `-`(B)), `*`(CS(3))) = `+`(C(3), `-`(`*`(`^`(B, 2), `*`(C(3))))) (36)
 

We now divide both sides by (1-B) so we get 

 

`/`(`*`(lhs(%)), `*`(`+`(1, `-`(B)))) = `/`(`*`(rhs(%)), `*`(`+`(1, `-`(B)))) 

CS(3) = `/`(`*`(`+`(C(3), `-`(`*`(`^`(B, 2), `*`(C(3)))))), `*`(`+`(1, `-`(B)))) (37)
 

We can now solve for C(3) 

 

isolate(%, C(3)) 

C(3) = `/`(`*`(CS(3), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 2)))))) (38)
 

 

Which is the expression for the optimal consumtion in period three 

 

 

 

 

 

Period-4 

 

 

Our terminal condition for period three is given by 

 

0 = `+`(CS(4), `-`(C(4))) 

0 = `+`(CS(4), `-`(C(4))) (39)
 

 

The above equation is already express in only C(4) terms which means that we can solve for consumption directly 

 

isolate(%, C(4)) 

C(4) = CS(4) (40)
 

 

Which is the expression for the optimal consumtion in period four 

 

 

 

 

 

 

Consumtion Dynamics Over Time 

 

 

restart 

 

 

We can now visualize the dynamics of consumtion over time 

 

 

We first note that the equations of motion for the cake size in period two and three are given by 

 

 

`:=`(CS(2), `+`(CS(1), `-`(C(1)))) 

`+`(CS(1), `-`(C(1))) (41)
 

`:=`(CS(3), `+`(CS(2), `-`(C(2)))) 

`+`(CS(1), `-`(C(1)), `-`(C(2))) (42)
 

`:=`(CS(4), `+`(CS(3), `-`(C(3)))) 

`+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3))) (43)
 

 

This means that the equation of motions can be written as 

 

 

C(1) = `/`(`*`(CS(1), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 4)))))) 

C(1) = `/`(`*`(CS(1), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 4)))))) (44)
 

C(2) = `/`(`*`(CS(2), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 3)))))) 

C(2) = `/`(`*`(`+`(CS(1), `-`(C(1))), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 3)))))) (45)
 

C(3) = `/`(`*`(CS(3), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 2)))))) 

C(3) = `/`(`*`(`+`(CS(1), `-`(C(1)), `-`(C(2))), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 2)))))) (46)
 

 

C(4) = CS(4) 

C(4) = `+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3))) (47)
 

 

 

We now assume that 

 

`:=`(CS(1), 100); -1 

 

`:=`(B, .9); -1 

 

 

 

Which means that the amount of consupmtion in each period are given by 

 

`:=`(C(1), `/`(`*`(CS(1), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 4))))))) 

29.07822041 (48)
 

 

`:=`(C(2), `/`(`*`(`+`(CS(1), `-`(C(1))), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 3))))))) 

26.17039837 (49)
 

 

`:=`(C(3), `/`(`*`(`+`(CS(1), `-`(C(1)), `-`(C(2))), `*`(`+`(1, `-`(B)))), `*`(`+`(1, `-`(`*`(`^`(B, 2))))))) 

23.55335854 (50)
 

 

`:=`(C(4), `+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3)))) 

21.19802268 (51)
 

 

 

 

We first make sure that all cake is consumed  

 

`+`(C(1), C(2), C(3), C(4)) 

100.0000000 (52)
 

 

 

We can now plot the consumption over time 

 

plot([1, 2, 3, 4], [C(1), C(2), C(3), C(4)], color = black, thickness = 3, labels = [time, consumption]) 

Plot_2d
 

 

 

We can now plot the cake size over time 

 

plot([1, 2, 3, 4, 5], [CS(1), CS(2), CS(3), CS(4), 0], color = black, thickness = 3, labels = [time, cakesize]) 

Plot_2d
 

 

 

 

Alternative Formulation 

 

 

Note that we could have solved the above problem in a much more straight forward way 

 

 

restart 

 

 

We assume that our utility from cake consumption at time t is given by 

 

u(c[t]) = ln(c[t]) 

u(c[t]) = ln(c[t]) (53)
 

 

We now note that we discount utility from cake consumption over time.  

 

The discounting is done through a discount factor B^t where B=1/(1+r) and r is the interest rate. Note that since B^t < 1 it means that `*`(u(c[t]), `*`(D)) will be decreasing over time.  

 

`*`(u(c[t]), `*`(D)) = `*`(`^`(B, t), `*`(ln(c[t]))) 

`*`(u(c[t]), `*`(D)) = `*`(`^`(B, t), `*`(ln(c[t]))) (54)
 

 

We now note that our objective is to maximize the sum of the discounted utility form consumption `*`(u(c[t]), `*`(D)) over time as seen below 

 

`*`(max, `*`(U(c[t]))) = Sum(`*`(u(c[t]), `*`(D))) 

`*`(max, `*`(U(c[t]))) = Sum(`*`(u(c[t]), `*`(D))) (55)
 

 

If we plug in the previous expression in this equation we get 

 

`*`(max, `*`(U(c[t]))) = Sum(`*`(`^`(B, t), `*`(ln(c[t])))) 

`*`(max, `*`(U(c[t]))) = Sum(`*`(`^`(B, t), `*`(ln(c[t])))) (56)
 

 

In our case our objective function Ob is therefor given by 

 

`:=`(Ob, `+`(`*`(B, `*`(ln(C[1]))), `*`(`^`(B, 2), `*`(ln(C[2]))), `*`(`^`(B, 3), `*`(ln(C[3]))), `*`(`^`(B, 4), `*`(ln(C[4]))))) 

`+`(`*`(B, `*`(ln(C[1]))), `*`(`^`(B, 2), `*`(ln(C[2]))), `*`(`^`(B, 3), `*`(ln(C[3]))), `*`(`^`(B, 4), `*`(ln(C[4])))) (57)
 

`:=`(con, [`+`(CS[1], `-`(C[1]), `-`(C[2]), `-`(C[3]), `-`(C[4])) = 0]) 

[`+`(CS[1], `-`(C[1]), `-`(C[2]), `-`(C[3]), `-`(C[4])) = 0] (58)
 

 

We again assume that 

 

`:=`(CS[1], 100); -1 

`:=`(B, .9); -1 

 

 

This gives us 

 

with(Optimization); -1 

Maximize(Ob, con, iterationlimit = 1000); 1 

[9.98411560825919686, [C[1] = 29.0782204111832989, C[2] = 26.1703983681569774, C[3] = 23.5533585387649752, C[4] = 21.1980226818947451]]
[9.98411560825919686, [C[1] = 29.0782204111832989, C[2] = 26.1703983681569774, C[3] = 23.5533585387649752, C[4] = 21.1980226818947451]]
(59)
 

 

Which is the same values of C[1], C[2] , C[3] and C[4] we had before 

 

 

 

 

 

 

 

2) Cake Eating in infinite Time  

 

 

 

restart 

 

The cake size in the end for a n period example is given by 

 

 

CS(`+`(n, 1)) = `+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3)), `-`(C(n))) 

CS(`+`(n, 1)) = `+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3)), `-`(C(n))) (60)
 

 

We again assume that all cake is gone in the last period which means that CS(n+1)=0.  

 

If we plug this into the previous equation then we get the expression for the terminal condition in period one 

 

0 = `+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3)), `-`(C(n))) 

0 = `+`(CS(1), `-`(C(1)), `-`(C(2)), `-`(C(3)), `-`(C(n))) (61)
 

 

We can now express this equation in C(1) terms only.  

 

C(2) = `*`(B, `*`(C(1))); -1 

 

 

 

`:=`(C(4), `*`(`^`(B, n), `*`(C(1)))) 

 

 

If we plug the all the rewritten expressions into the previous equation we get 

 

0 = `+`(CS(1), `-`(C(1)), `-`(`*`(B, `*`(C(1)))), `-`(`*`(`^`(B, 2), `*`(C(1)))), `-`(`*`(`^`(B, n), `*`(C(1))))) 

0 = `+`(CS(1), `-`(C(1)), `-`(`*`(B, `*`(C(1)))), `-`(`*`(`^`(B, 2), `*`(C(1)))), `-`(`*`(`^`(B, n), `*`(C(1))))) (62)
 

which can be written as 

 

CS(1) = solve(%, CS(1)) 

CS(1) = `+`(C(1), `*`(B, `*`(C(1))), `*`(`^`(B, 2), `*`(C(1))), `*`(`^`(B, n), `*`(C(1)))) (63)
 

collect(%, C(1)) 

CS(1) = `*`(`+`(1, B, `*`(`^`(B, 2)), `^`(B, n)), `*`(C(1))) (64)
 

 

We now note that 

 

########################################## 

 

if we assume that  

 

`:=`(B, .9); -1 

 

then the sum 

 

X = `+`(1, B, `*`(`^`(B, 2)), `*`(`^`(B, 3)), `*`(`^`(B, 4)), `*`(`^`(B, 5))) 

X = 4.68559 (65)
 

 

can be approximated by 

 

 

X = `/`(`*`(`+`(1, `-`(`*`(`^`(B, 6))))), `*`(`+`(1, `-`(B)))) 

X = 4.685590000 (66)
 

 

restart 

 

########################################## 

 

 

 

The sum of  `+`(1, B, `*`(`^`(B, 2)), `^`(B, n)) can therefor be approximated by the expression 

 

`/`(`*`(`+`(1, `-`(`^`(B, `+`(n, 1))))), `*`(`+`(1, `-`(B)))) 

`/`(`*`(`+`(1, `-`(`^`(B, `+`(n, 1))))), `*`(`+`(1, `-`(B)))) (67)
 

which means that we can write the above expression as 

 

CS(1) = `*`([`/`(`*`(`+`(1, `-`(`^`(B, `+`(n, 1))))), `*`(`+`(1, `-`(B))))], `*`(C(1))) 

CS(1) = `*`([`/`(`*`(`+`(1, `-`(`^`(B, `+`(n, 1))))), `*`(`+`(1, `-`(B))))], `*`(C(1))) (68)
 

which gives us 

 

C(1) = `/`(`*`(CS(1)), `*`([`/`(`*`(`+`(1, `-`(`^`(B, `+`(n, 1))))), `*`(`+`(1, `-`(B))))])) 

C(1) = `/`(`*`(CS(1)), `*`([`/`(`*`(`+`(1, `-`(`^`(B, `+`(n, 1))))), `*`(`+`(1, `-`(B))))])) (69)
 

which means that that consumption is given by 

 

 

C(1) = `*`(CS(1), `*`([`/`(`*`(`+`(1, `-`(B))), `*`(`+`(1, `-`(`^`(B, `+`(n, 1))))))])) 

C(1) = `*`(CS(1), `*`([`/`(`*`(`+`(1, `-`(B))), `*`(`+`(1, `-`(`^`(B, `+`(n, 1))))))])) (70)
 

 

We now note that  

 

########################################## 

 

when proc (n) options operator, arrow; infinity end proc then  

 

We can show this by noting that 

 

restart; 1; `:=`(B, .9); -1; seq(`^`(B, `+`(n, 1)), n = 1 .. 50) 

.81, .729, .6561, .59049, .531441, .4782969, .43046721, .387420489, .3486784401, .3138105961, .2824295365, .2541865828, .2287679246, .2058911321, .1853020189, .1667718170, .1500946353, .1350851718, .1...
.81, .729, .6561, .59049, .531441, .4782969, .43046721, .387420489, .3486784401, .3138105961, .2824295365, .2541865828, .2287679246, .2058911321, .1853020189, .1667718170, .1500946353, .1350851718, .1...
.81, .729, .6561, .59049, .531441, .4782969, .43046721, .387420489, .3486784401, .3138105961, .2824295365, .2541865828, .2287679246, .2058911321, .1853020189, .1667718170, .1500946353, .1350851718, .1...
.81, .729, .6561, .59049, .531441, .4782969, .43046721, .387420489, .3486784401, .3138105961, .2824295365, .2541865828, .2287679246, .2058911321, .1853020189, .1667718170, .1500946353, .1350851718, .1...
.81, .729, .6561, .59049, .531441, .4782969, .43046721, .387420489, .3486784401, .3138105961, .2824295365, .2541865828, .2287679246, .2058911321, .1853020189, .1667718170, .1500946353, .1350851718, .1...
.81, .729, .6561, .59049, .531441, .4782969, .43046721, .387420489, .3486784401, .3138105961, .2824295365, .2541865828, .2287679246, .2058911321, .1853020189, .1667718170, .1500946353, .1350851718, .1...
.81, .729, .6561, .59049, .531441, .4782969, .43046721, .387420489, .3486784401, .3138105961, .2824295365, .2541865828, .2287679246, .2058911321, .1853020189, .1667718170, .1500946353, .1350851718, .1...
.81, .729, .6561, .59049, .531441, .4782969, .43046721, .387420489, .3486784401, .3138105961, .2824295365, .2541865828, .2287679246, .2058911321, .1853020189, .1667718170, .1500946353, .1350851718, .1...
(71)
 

 

########################################## 

 

 

This means that our previous equation is reduced to 

 

 

C(1) = `*`(CS(1), `*`([`+`(1, `-`(B))])) 

C(1) = `*`(CS(1), `*`([.1])) (72)
 

 

We can now visualize the consumtion and cake size over time 

 

 

 

Consumption vector 

 

restart; 1; `:=`(B, .9); -1; `:=`(Initial_Cake, 100); -1; `:=`(c[1], `*`(`+`(1, `-`(B)), `*`(Initial_Cake))); -1; for n from 2 to 50 do `:=`(c[n], `*`(B, `*`(c[`+`(n, `-`(1))]))) end do; -1; `:=`(cons...
restart; 1; `:=`(B, .9); -1; `:=`(Initial_Cake, 100); -1; `:=`(c[1], `*`(`+`(1, `-`(B)), `*`(Initial_Cake))); -1; for n from 2 to 50 do `:=`(c[n], `*`(B, `*`(c[`+`(n, `-`(1))]))) end do; -1; `:=`(cons...
restart; 1; `:=`(B, .9); -1; `:=`(Initial_Cake, 100); -1; `:=`(c[1], `*`(`+`(1, `-`(B)), `*`(Initial_Cake))); -1; for n from 2 to 50 do `:=`(c[n], `*`(B, `*`(c[`+`(n, `-`(1))]))) end do; -1; `:=`(cons...
restart; 1; `:=`(B, .9); -1; `:=`(Initial_Cake, 100); -1; `:=`(c[1], `*`(`+`(1, `-`(B)), `*`(Initial_Cake))); -1; for n from 2 to 50 do `:=`(c[n], `*`(B, `*`(c[`+`(n, `-`(1))]))) end do; -1; `:=`(cons...
restart; 1; `:=`(B, .9); -1; `:=`(Initial_Cake, 100); -1; `:=`(c[1], `*`(`+`(1, `-`(B)), `*`(Initial_Cake))); -1; for n from 2 to 50 do `:=`(c[n], `*`(B, `*`(c[`+`(n, `-`(1))]))) end do; -1; `:=`(cons...
 

[10.0, 9.00, 8.100, 7.2900, 6.56100, 5.904900, 5.3144100, 4.78296900, 4.304672100, 3.874204890, 3.486784401, 3.138105961, 2.824295365, 2.541865828, 2.287679245, 2.058911320, 1.853020188, 1.667718169, ...
[10.0, 9.00, 8.100, 7.2900, 6.56100, 5.904900, 5.3144100, 4.78296900, 4.304672100, 3.874204890, 3.486784401, 3.138105961, 2.824295365, 2.541865828, 2.287679245, 2.058911320, 1.853020188, 1.667718169, ...
[10.0, 9.00, 8.100, 7.2900, 6.56100, 5.904900, 5.3144100, 4.78296900, 4.304672100, 3.874204890, 3.486784401, 3.138105961, 2.824295365, 2.541865828, 2.287679245, 2.058911320, 1.853020188, 1.667718169, ...
[10.0, 9.00, 8.100, 7.2900, 6.56100, 5.904900, 5.3144100, 4.78296900, 4.304672100, 3.874204890, 3.486784401, 3.138105961, 2.824295365, 2.541865828, 2.287679245, 2.058911320, 1.853020188, 1.667718169, ...
[10.0, 9.00, 8.100, 7.2900, 6.56100, 5.904900, 5.3144100, 4.78296900, 4.304672100, 3.874204890, 3.486784401, 3.138105961, 2.824295365, 2.541865828, 2.287679245, 2.058911320, 1.853020188, 1.667718169, ...
[10.0, 9.00, 8.100, 7.2900, 6.56100, 5.904900, 5.3144100, 4.78296900, 4.304672100, 3.874204890, 3.486784401, 3.138105961, 2.824295365, 2.541865828, 2.287679245, 2.058911320, 1.853020188, 1.667718169, ...
[10.0, 9.00, 8.100, 7.2900, 6.56100, 5.904900, 5.3144100, 4.78296900, 4.304672100, 3.874204890, 3.486784401, 3.138105961, 2.824295365, 2.541865828, 2.287679245, 2.058911320, 1.853020188, 1.667718169, ...
(73)
 

plot([seq(i, i = 1 .. 50)], consumption_vector, color = black, thickness = 3, labels = [time, consumption]) 

Plot_2d
 

 

 

 

Cake size vector 

 

for n to 50 do `:=`(cs[n], `+`(Initial_Cake, `-`(sum(c[t], t = 1 .. n)))) end do; -1; `:=`(cake_size_vector, [seq(cs[n], n = 1 .. 50)]); 1
for n to 50 do `:=`(cs[n], `+`(Initial_Cake, `-`(sum(c[t], t = 1 .. n)))) end do; -1; `:=`(cake_size_vector, [seq(cs[n], n = 1 .. 50)]); 1
 

[90.0, 81.00, 72.900, 65.6100, 59.04900, 53.144100, 47.8296900, 43.04672100, 38.74204890, 34.86784401, 31.38105961, 28.24295365, 25.41865828, 22.87679245, 20.58911320, 18.53020188, 16.67718169, 15.009...
[90.0, 81.00, 72.900, 65.6100, 59.04900, 53.144100, 47.8296900, 43.04672100, 38.74204890, 34.86784401, 31.38105961, 28.24295365, 25.41865828, 22.87679245, 20.58911320, 18.53020188, 16.67718169, 15.009...
[90.0, 81.00, 72.900, 65.6100, 59.04900, 53.144100, 47.8296900, 43.04672100, 38.74204890, 34.86784401, 31.38105961, 28.24295365, 25.41865828, 22.87679245, 20.58911320, 18.53020188, 16.67718169, 15.009...
[90.0, 81.00, 72.900, 65.6100, 59.04900, 53.144100, 47.8296900, 43.04672100, 38.74204890, 34.86784401, 31.38105961, 28.24295365, 25.41865828, 22.87679245, 20.58911320, 18.53020188, 16.67718169, 15.009...
[90.0, 81.00, 72.900, 65.6100, 59.04900, 53.144100, 47.8296900, 43.04672100, 38.74204890, 34.86784401, 31.38105961, 28.24295365, 25.41865828, 22.87679245, 20.58911320, 18.53020188, 16.67718169, 15.009...
[90.0, 81.00, 72.900, 65.6100, 59.04900, 53.144100, 47.8296900, 43.04672100, 38.74204890, 34.86784401, 31.38105961, 28.24295365, 25.41865828, 22.87679245, 20.58911320, 18.53020188, 16.67718169, 15.009...
(74)
 

 

plot([seq(i, i = 1 .. 50)], consumption_vector, color = black, thickness = 3, labels = [time, cakesize]) 

Plot_2d
 

 

Legal Notice: The copyright for this application is owned by the authors. Neither Maplesoft nor the authors are responsible for any errors contained within and are not liable for any damages resulting from the use of this material.. This application is intended for non-commercial, non-profit use only. Contact the authors for permission if you wish to use this application in for-profit activities.