Forget the Perfect Formula. Health Is Gradient Descent.

Published Categorized as The Long Game

Today I want to take you on a little journey: to show what math and engineering can teach us about nutrition and health. And maybe we’ll even take the tiniest peek into how computers do all the cool things they do these days like for example AI aka large language models.

OK wait, what? 😅
I know, it sounds like three very different worlds colliding. Welcome to my world. Do you know one of the main reasons I studied Mathematics (apart from being crazy obviously)? It is a dead certain science. You state your problem, and all the conditions under which you can draw a conclusion. Then you proceed to show how one step follows exactly from another. Boom. It is so very satisfying. Truth established, no room for any ambivalence.

Meanwhile in the real world my PhD had me in for a rude awakening and confronted me with fatigue (not the medical kind- not yet hah). No, the fatigue of carbon fiber reinforced composites. These are messy materials to model: baked together sheets of epoxy resin that are embedded with strands of carbon fibers. It is hard to get consistent feedback on their behavior under simple and relatively perfect lab conditions. You basically never know what’s going to break (and that’s what we want to know: when and how).

It is a perfect example for how mathematics transfers to the real world: it is a very useful framework but it’s also a hardcore abstraction. Does that mean that we should throw our hands up and lament that it’s SO complicated and confusing we might as well stop and eat some chocolate? Does it mean that we should say Mathematics is totally useless because it doesn’t provide the answers directly? No of course not. But we do need to stop expecting THE answer. Indeed it doesn’t necessarily exist. And even if it does there’s no guarantee- not even a likelihood- we’ll find it.

I see the craving for certainty everywhere. I read studies on nutrition, the articles about those studies, and the comment sections underneath. The hand-wringing is common: many of us are closet mathematicians, desperate for clean conclusions in a world with too many variables. That craving keeps the wellness and diet industry humming. It cycles through trends. A, then B, then C each sold as the ultimate answer. Sometimes A or B or C fits person A or B or C. But as person D you’re at a loss. That doesn’t discredit nutritional science as it’s completely normal and not limited to this field. All research follows trends.

So what to do?

Treat food like an engineering problem, not a math problem. You have an idea, you try it, you note what works and what doesn’t, and then you iterate. Even in simulations, algorithms don’t ‘solve’ complex systems outright; they use numerical methods: approximate, not exact. You start with a guess and move in the direction that improves things. From your new location, you look at the slope again and take the next step. This is gradient descent. Keep stepping downhill and you’ll eventually reach a valley. Maybe not the absolute lowest on Earth, but low enough to live well. A bit like a skier looking for the fastest way down or a ball rolling down a hill.

Here’s an example: on the left, a parabola with one clear minimum. The solution can be calculated exactly. On the right, a more complicated mash-up of variables. There’s no neat solution, just hills and valleys. And remember, you can only draw landscapes like these when you’re looking at one or two variables. Health is exactly like this: simple rules look elegant, but your actual landscape is messier. Real problems have thousands; in AI, millions or even billions of parameters.

That’s why all modern machine learning algorithms rely on gradient descent (or a variant of it). And not only that: your AI conversations -not perfect but surprisingly helpful- are only possible because the system sacrifices perfection for speed. It doesn’t calculate the slope everywhere; instead, it does so stochastically, by sampling a subset of the information and making an educated guess. It’s a bit like shining a torch on the landscape: you don’t see everything, just enough to take the next step. And that’s the whole point.

Stochastic: a flashlight beam, not the whole map

Nutrition is just the same: it isn’t a neat math problem where the solution drops out once you plug in the numbers. It’s more like being dropped into a mountain range in the fog. You don’t see the whole map, so you can’t calculate the exact best route. What you can do is feel your footing, check the slope, and take a step. Then another. No perfect formula, just small adjustments that move you in the right direction.

Real life: foggy mountains, limited view.

It’s slower. Less sexy. But it works because there is always a next step. Whereas trying to take in everything before even starting makes you give up, it adapts to real life. Another beauty of gradient descent is that it still works even when the slope isn’t smooth. In math, a discontinuous derivative would break the neat formula. In life, discontinuities are the rule: new jobs, new hormones, new diagnoses. That’s exactly when closed-form diets collapse but iteration keeps going. Take the next step that makes sense from where you are, even if the terrain is jagged.

Of course, there’s also a catch: gradient descent can get stuck in small valleys. Mathematically, you sometimes need to increase the step size to jump out. Health is similar. Most of the time, small tweaks are best. But when I was in the deep hole of long Covid, tiny adjustments weren’t enough. That’s when I reached for bigger interventions — keto, fasting — to jolt the system. They felt like big jumps, and they were. But once I was out of the hole, I didn’t stay on the extreme path forever. I went back to small, steady steps. That’s the dance.”

Gradient descent: like rolling a ball down the hill. Step, check, step again.

So this is how I’ve learned to treat my own food choices. Over the years, I’ve shifted again and again: more carbs when I was exercising hard, a hard adjustment when I lost my cycle after 18 months of weight loss, fewer carbs when life got sedentary, keto when I wanted autophagy, intermittent fasting for energy and fasting for immune support. Each change was an experiment, not a dogma. And exceptions were always part of the deal, because real life is messy. Full-time jobs, pregnancy, kids, moves, and yes why not throw in some chronic illness.

The point is not to find the closed-form “perfect diet.” The point is to keep descending, step by step, toward what works for your body, right now.

The benefit of reframing your health, whether it’s weight loss, fitness, or pain, is this: there is always a next step. There are no failures. You can adjust your step size to where you are in life right now, you don’t need to wait for conditions to improve. And you don’t need to find perfection.

So what’s your goal? Is there something you can start trying today…maybe even something fun? Because that’s the thing about health: it isn’t about perfection, it’s about pattern-spotting, experimenting, and adjusting. Sometimes the best step is as simple as deciding to be okay with where you are right now. There is only one thing you need to avoid: being stuck. And that’s not the same as standing still.

Forget the perfect formula. Health is gradient descent: one step at a time, adjusting as you go. Q.E.D.


If you’re interested in reflections on the body, the mind, and real life, feel free to sign up for my newsletter.

Leave a comment

Your email address will not be published. Required fields are marked *