Dynamic programming
Calculating the derivatives
1
2
p
c
=
p
1 +k+k^2 +.. .+kt k
2
p
k(w c)
p
c=p^1
1 +k+k^2 +.. .+kt
p
wp c
k
kc=
1
1 +k+k^2 +.. .+kt(w c)
c
k+
1
1 +k+k^2 +.. .+kt
=
w
1 +k+k^2 +.. .+kt
c
k+.. .+kt+^1 + 1
1 +k+k^2 +.. .+kt =
w
1 +k+k^2 +.. .+kt
c= w
1 +k+k^2 +.. .+kt+kt+^1