Third version

The problem of negative consumption is fixed.
However it appears that the value function is not always increasing in k
(which seems strange and is certainly a mistake).
This is likely to come from the max operator or the computation of EV0.
However I would favor the first hypothesis.
This is tomorrow's job.