A mathematical approach to weight loss: closedloope control
A mathematical approach to weight loss: closedloope control
Here is a guy (Danish of course, his name is even Jakob) whose mathematical approach to weight control is as clever as it is simple. And the math guarantees you exactly the weight you want to loose or maintain.
The Technology Professor Jakob Stoustrups has developed a control theory perspective on weight control and made it into a simple feedback algorithm. He also tried it out himself, thus providing experimental data verifying the algorithm.
His idea is that you plot your target weight for each day into a diagram and then you weigh yourself each day +you weigh your food and eat exactly the weight of food you need in order for weight of food plus weight of body to match the target weight. No less, no more. That is all you need to do.
There are no criteria for what kind of food or when to eat it during the day. Of course common sense says to eat sensibly healthy, but that is not even relevant if weight loss is the only aim.
Weightloss Jakob set a target to loose 7.4 kg during a 31day weight loss period, i.e. a daily decrement of 239 g, and after 31 days, he had lost exactly 7.4 kg.
The full description including math and biology is here:
http://blog.ifaccontrol.org/2016/12/05 ... feedback/
The Technology Professor Jakob Stoustrups has developed a control theory perspective on weight control and made it into a simple feedback algorithm. He also tried it out himself, thus providing experimental data verifying the algorithm.
His idea is that you plot your target weight for each day into a diagram and then you weigh yourself each day +you weigh your food and eat exactly the weight of food you need in order for weight of food plus weight of body to match the target weight. No less, no more. That is all you need to do.
There are no criteria for what kind of food or when to eat it during the day. Of course common sense says to eat sensibly healthy, but that is not even relevant if weight loss is the only aim.
Weightloss Jakob set a target to loose 7.4 kg during a 31day weight loss period, i.e. a daily decrement of 239 g, and after 31 days, he had lost exactly 7.4 kg.
The full description including math and biology is here:
http://blog.ifaccontrol.org/2016/12/05 ... feedback/
Re: A mathematical approach to weight loss: closedloope control
doesn't solve any of the problems humans have with fat loss  like hunger, boredom, conditioning, social pressure..
as far as algorithms go, brute's algorithm is far better:
1)eat if target weight reached. if above target weight, no eating.
2)go to 1
as far as algorithms go, brute's algorithm is far better:
1)eat if target weight reached. if above target weight, no eating.
2)go to 1
Re: A mathematical approach to weight loss: closedloope control
I'm rather impressed by how much he simplified the problem. His model is beautifully crude. It's something I can appreciate after skimming a bunch of academic literature trying to determine who was first to prove the feasibility of extreme ER.
In the FIRE analogy, the people who were wellversed in the "science" were off studying other problems. Economists and financial planners trying to predict and optimize/maximize consumption. Several academics independently had the insight that a high savings rate means more money saved AND not having to save as much for retirement. But they were locked into closeminded assumptions about retirement age, and their financial equations were too overly complicated for them to discover the possibility of FIRE.
Jacob's assumptions in deriving the FIRE equations are just as crude as the human body model that we're discussing here. The constantincome, constantspending assumption even makes nonacademics squirm. But the resulting conclusions are robust to realworld variations in income and spending. It's good enough, and that's what matters.
As another note, this concept of "weight loss feedback control" can be applied to any system that obeys a conservation law, even personal finance. One can design a variable budget that responds to changes in net worth and use that to reach financial goals. The concept is simple but as with weight loss the difficulty is psychological.
But you don't even need feedback to FIRE. Based on a target FI date, choose the appropriate savings rate (e.g. 75%) and whenever you have ANY income, first put 75% into a savings account/locked box/investments. The remaining 25% is the entire budget (no debt allowed!) and can be spent on anything. Keep it up and you will begin an inexorable march to FI.
In the FIRE analogy, the people who were wellversed in the "science" were off studying other problems. Economists and financial planners trying to predict and optimize/maximize consumption. Several academics independently had the insight that a high savings rate means more money saved AND not having to save as much for retirement. But they were locked into closeminded assumptions about retirement age, and their financial equations were too overly complicated for them to discover the possibility of FIRE.
Jacob's assumptions in deriving the FIRE equations are just as crude as the human body model that we're discussing here. The constantincome, constantspending assumption even makes nonacademics squirm. But the resulting conclusions are robust to realworld variations in income and spending. It's good enough, and that's what matters.
As another note, this concept of "weight loss feedback control" can be applied to any system that obeys a conservation law, even personal finance. One can design a variable budget that responds to changes in net worth and use that to reach financial goals. The concept is simple but as with weight loss the difficulty is psychological.
But you don't even need feedback to FIRE. Based on a target FI date, choose the appropriate savings rate (e.g. 75%) and whenever you have ANY income, first put 75% into a savings account/locked box/investments. The remaining 25% is the entire budget (no debt allowed!) and can be spent on anything. Keep it up and you will begin an inexorable march to FI.
Re: A mathematical approach to weight loss: closedloope control
@Eureka Nice post, yes your Danes are loved: all those Jacobs, and the beautiful drama Borgen I saw last year on DVD!!
But my math is a little bit eroded. Jacob made a little sheet how his math worked out. Can I ask you to make a little sheet how the math of this Jacob works out? Lets say my weight is now 78 kg, I want to reduce it to 73 in 40 days. What must be the weight of my food intakes per day?
But my math is a little bit eroded. Jacob made a little sheet how his math worked out. Can I ask you to make a little sheet how the math of this Jacob works out? Lets say my weight is now 78 kg, I want to reduce it to 73 in 40 days. What must be the weight of my food intakes per day?

 Site Admin
 Posts: 9064
 Joined: Fri Jun 28, 2013 8:38 pm
 Location: USA, Zone 5b, Koppen Dfa, Elev. 620ft, Walkscore 73
 Contact:
Re: A mathematical approach to weight loss: closedloope control
@J_ 
daily_loss=(7873)/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 780.125*tX (if it's negative, you can't eat anything)
For t>40, you can eat 73X (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 detailsin 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.
daily_loss=(7873)/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 780.125*tX (if it's negative, you can't eat anything)
For t>40, you can eat 73X (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 detailsin 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.
Re: A mathematical approach to weight loss: closedloope control
i.e. the algorithm simplifies too much to actually be useful. if "any math sounding thing will provide motivation" is good enough, there are billions of other pseudoscientific and equally useless ideas out there, like brute's "no eating until weight loss completed" protocol (which is both easier and more effective).
Re: A mathematical approach to weight loss: closedloope control
I think this might proof to be a useful algorithm because it has been shown that one of the major differences in behavior between thin vs. heavier people is that the thin individuals maintain a tighter boundary on weight they find acceptable. It would also have the benefit of being more accurate and less tedious than calorie counting/calculation. The main obstacle, as was noted as a minor problem by the author, would be the social liability of having to weigh your food, and also the need to always have access to a body weight scale.
One question that immediately occurred to me was how were noncaloric beverages taken into account in this method? The average adult human body is about 65% water with men or more muscular people retaining relatively higher percentage vs. females or more fatty people. Most inexpensive food contain little water because dehydration or condensation reduces storage and transportation costs. So, rice, lentils, oatmeal, all need to be rehydrated to be rendered edible. OTOH, Dollar Store cookies and walnuts can be eaten without rehydration due to high fat content. Butter, raw ground beef, rehydrated lentils and water have approximately the same weight for equivalent volume. A cup of honey will weigh approximately 50% more than a cup of butter, but hold fewer kilocalories.
So, a simpler approximation for measured weight of food would be measured fresh,wet and/or raw volume with 2 cups equivalent to 1 lb. in the archaic system with which I am most familiar. A human being who weighs 150 lbs consists of approximately 300 cups of fresh, raw, wet flesh. The average human tends towards wanting to consume somewhere between 2 or 3 lbs. (or 4 to 6 cups )of food/day towards satiety. Therefore, the most simplistic BRUTE diet might be best achieved by combining daily internal burn/consumption of 2 cups raw human flesh (approximately 2100 kcalories) with intake of 2 to 4 cups of broth (24 to 60 kilocalories.) Those who suffer from the desire to "have a life" or other weaknesses, could adopt/adapt some more moderate practice that would hold volume/weight of food steady, but adjust water content of next meal, or set of meals, based on last measurement of body weight in adherence with initial algorithm.
One question that immediately occurred to me was how were noncaloric beverages taken into account in this method? The average adult human body is about 65% water with men or more muscular people retaining relatively higher percentage vs. females or more fatty people. Most inexpensive food contain little water because dehydration or condensation reduces storage and transportation costs. So, rice, lentils, oatmeal, all need to be rehydrated to be rendered edible. OTOH, Dollar Store cookies and walnuts can be eaten without rehydration due to high fat content. Butter, raw ground beef, rehydrated lentils and water have approximately the same weight for equivalent volume. A cup of honey will weigh approximately 50% more than a cup of butter, but hold fewer kilocalories.
So, a simpler approximation for measured weight of food would be measured fresh,wet and/or raw volume with 2 cups equivalent to 1 lb. in the archaic system with which I am most familiar. A human being who weighs 150 lbs consists of approximately 300 cups of fresh, raw, wet flesh. The average human tends towards wanting to consume somewhere between 2 or 3 lbs. (or 4 to 6 cups )of food/day towards satiety. Therefore, the most simplistic BRUTE diet might be best achieved by combining daily internal burn/consumption of 2 cups raw human flesh (approximately 2100 kcalories) with intake of 2 to 4 cups of broth (24 to 60 kilocalories.) Those who suffer from the desire to "have a life" or other weaknesses, could adopt/adapt some more moderate practice that would hold volume/weight of food steady, but adjust water content of next meal, or set of meals, based on last measurement of body weight in adherence with initial algorithm.
Re: A mathematical approach to weight loss: closedloope control
@ Jacob, thank you for your clarification. It helped me really.
@ Brute, it is for me not an unuseful thread, (but I like your algorithm
Things I learned:
1 that most bodyweight you loose via the CO2 and waterdamp in your breath. As stated in the original article.
I weighted myself last night before sleeping, and this morning: it is true I was 1 lbs (0,5 kg) lighter!
2 I like professors who use their own body to verify their thesis! His graph and clarification helps a lot to understand his formula and how your body behaves.
3 I do not have a bodyweight issue, but I think I can help others who have problems with this approach.
Brute's algorithm is too simple, as you do not eat you die or got ill. Not everyone is so strong as Brute who does not need any food if he is too fat.
@ Brute, it is for me not an unuseful thread, (but I like your algorithm
Things I learned:
1 that most bodyweight you loose via the CO2 and waterdamp in your breath. As stated in the original article.
I weighted myself last night before sleeping, and this morning: it is true I was 1 lbs (0,5 kg) lighter!
2 I like professors who use their own body to verify their thesis! His graph and clarification helps a lot to understand his formula and how your body behaves.
3 I do not have a bodyweight issue, but I think I can help others who have problems with this approach.
Brute's algorithm is too simple, as you do not eat you die or got ill. Not everyone is so strong as Brute who does not need any food if he is too fat.
Re: A mathematical approach to weight loss: closedloope control
incorrect. above crazy low body fat (~5% for human males, ~10% for human females), no food intake is needed for survival. that's what body fat does.J_ wrote:Brute's algorithm is too simple, as you do not eat you die or got ill. Not everyone is so strong as Brute who does not need any food if he is too fat.
Re: A mathematical approach to weight loss: closedloope control
I am going to try this plan. My digital scale registers to 1/10 lb., so I will make my projected goal of daily loss = .3 lbs. It is not always convenient to weigh my food, so I will make use of a plastic sandwich box which holds exactly 16 oz. of water for purposes of volume estimation of weight combined with a bit of common sense about high volume low calorie foods such as salad greens.
Re: A mathematical approach to weight loss: closedloope control
the scale might show a precision of 1/10th of a lb, but that might not be accurate. few body weight scales are accurate to even one pound. regular daily fluctuations in fluids and intestine content are also easily up to 510 lbs. in the graph in the OP, swings are around 34kg per day, pretty much the same amount.
godspeed.
godspeed.

 Posts: 211
 Joined: Fri May 20, 2016 5:55 am
Re: A mathematical approach to weight loss: closedloope control
Yet it did seem to work for the OP.BRUTE wrote:the scale might show a precision of 1/10th of a lb, but that might not be accurate. few body weight scales are accurate to even one pound. regular daily fluctuations in fluids and intestine content are also easily up to 510 lbs. in the graph in the OP, swings are around 34kg per day, pretty much the same amount.
Re: A mathematical approach to weight loss: closedloope control
@brute I am not so sure. I have read examples I'm sure where people die with fat still on them during an extended fast.
Re: A mathematical approach to weight loss: closedloope control
@BRUTE: I understand the likelihood of fluctuations and inaccuracy. That's why I used the word "registers" instead of the word "measures." I hopped on the scale before dinner yesterday, and arbitrarily set my goal weight in my spreadsheet for the day to be 1 lb. higher with .3 lb/day linear decrease. Then I had 12 oz of egg fried rice and 4 oz of butterscotch pudding for my dinner (total cost less than $.40.) This morning I weighed 6 lbs. less than my goal weight for today, so I shall enjoy a hearty 1.5 lbs of food for both breakfast and lunch. Easiest, cheapest diet ever!!!
Re: A mathematical approach to weight loss: closedloope control
Somehow I managed to lose more weight between morning and afternoon weighin, so now I am supposed to eat 3.75 lbs. of food for my dinner. I don't want to eat that much food. This is not the problem I expected to encounter. Granting myself that first lb of slack initially is sending the system out of bounds!!!
Re: A mathematical approach to weight loss: closedloope control
I have been bobbing up and down a bit, like the graph exhibited above, but I have lost a solid 5 or 6 lbs. in 15 days following this method. I continue to find compliance very easy and visual estimation of weight of food to be "good enough." I am pleased that this plan is working for me, because it will be a good fit in my overall system design with my total weight goal for production in my permaculture food production/processing project. Measuring food consumption or production in kilocalories is quite tedious by comparison.
Re: A mathematical approach to weight loss: closedloope control
This was a fun article to read.
It is very similar to the Steve Ward diet: http://philip.greenspun.com/writing/cha ... andweblog (from 2009, second headline). It uses kind of bangbang control.
Just eat only broccoli on overweight days.
It is very similar to the Steve Ward diet: http://philip.greenspun.com/writing/cha ... andweblog (from 2009, second headline). It uses kind of bangbang control.
Just eat only broccoli on overweight days.