@J_ -
daily_loss=(78-73)/40=0.125kg/day
If t is the day and X(t) is your weight on that day then
For t=<40, you can eat 78-0.125*t-X (if it's negative, you can't eat anything)
For t>40, you can eat 73-X (if it's negative, you can't eat anything)
This approach is a very simple proportional control system (see
https://en.wikipedia.org/wiki/PID_controller) that takes advantage of a few physiological facts, namely that "humans are made out of food" which means that the amount of calories that takes to lose a kilo of weight is very approximately the same(*) as the amount of calories one needs to eat (beyond what one uses) to gain a kilo.
There are many ways to improve a PID controller to make it more stable ... e.g. make it less likely that you go into "hunting"-mode where you don't get to eat one day .. but then have to eat a lot the next day. In the paper, he doubles the measuring frequency to compensate. The right way to do it would be with a Kalman filter that takes other variables into account along with a physiological model, but it would drown the illustrative purpose in math. That, however, would be the way to go if you were to put it into a fitness product.
(*) You'll notice that in practice ... 1kg of potatoes is 800kcal. 1kg of bodymass is 7700kcal. 1kg of olive oil is 9000kcal. In order for the algorithm to be unbiased, your food's energy density should be the same as the density of what you're eating. In practice, unless you subsist on a diet of olive oil, the algo is biased to make you lose weight even if you're trying to maintain it. You can of course again fix this by looking at caloric flows instead of mass flows(**) but again that would drown the point/paper in details---in particular it would require people to use calorie calculators for every meal ... something few dieters seem willing to do. (All sorts of schemes have been invented to make this process easier. Weight Watcher points (precalculated), Beach Body containers (by volume and type instead of mass), scales with built in calculators, apps, preset diets.)
(**) The algo could be fixed by fiddling with the amplication factor, e.g. if you eat only potatoes, your K factor is 7700/800 = 9.6 .. so if you're 72kg, you get to eat 9.6kg of potatoes.