The Algorithm of the Mind: The Mathematical Models of Depression and Anxiety

תחום מחקר
Psychology, brain and mental health
paul sharp

What if depression isn’t just an emotional state, but a glitch in the brain’s internal calculations? Dr. Paul Sharp, a pioneer in computational psychiatry, is using mathematical models and advanced imaging to probe why the brain sometimes misfires in weighing reward and punishment. In a thought-provoking interview, he argues that, paradoxically, it’s precisely this mathematical lens that may bring a deeper sense of humanity back into psychiatric care.

Imagine a future, just a few years away, in which someone struggling with severe anxiety no longer has to endure a grueling trial-and-error journey through different medications. Instead, they complete a brief computer task, and a mathematical model pinpoints the exact mechanism disrupted in their brain: is it a biological impairment in how reward and punishment are processed, requiring medication, or a breakdown in forecasting future scenarios, better addressed through cognitive training?

Dr. Paul Sharp, a pioneer in computational psychiatry, has spent his career at leading institutions, from UCL in London to Yale University, and is now working in his lab in Israel to make this vision a reality. There, he is developing the tools that could transform psychiatric diagnosis into a precise, objective, and personalized science.

Dr. Sharp, now a senior lecturer in the Department of Psychology and the Gonda Brain Research Center at Bar-Ilan University, as well as a research fellow at the Dangoor Center for Personalized Medicine, stands at the forefront of this revolution. His ambition is clear, even as he candidly acknowledges that the science hasn’t quite caught up yet: the models he is developing are designed to map these underlying mechanisms, identify the specific “bug” in the brain’s software, and match the right key to each mental lock.

“We’re only at the beginning,” he says in soft Hebrew, tinged with an American accent, “but the vision is to stop guessing. Today, a psychiatrist prescribes a medication and then waits two months to see if it works. That’s precious time marked by human suffering. Our goal is to use a kind of ‘digital blood test,’ computational tasks that measure how the brain processes information, to determine in advance which mechanism needs fixing, and which treatment will bring the fastest relief.”

The Brain as a Reinforcement Learning System

At the core of Dr. Sharp’s research lies the concept of “reinforcement learning.” In the world of artificial intelligence, this is an algorithm that describes how a system learns to take optimal actions based on rewards and punishments. Dr. Sharp applies this framework to the human brain, grounded in the idea that the mind is constantly trying to predict the future.

“In the real world, learning from reward and punishment is incredibly complex,” Dr. Sharp explains. “We operate in an environment that’s constantly changing. Imagine an animal in the forest searching for food; it learns that a certain area has fruit, but then the season shifts and the food disappears. What makes humans intelligent is the ability to understand ‘what causes what.’ We don’t just react to stimuli, we build an internal model of reality. Mental disorders are often deviations in the parameters of that model; the brain is simply making an incorrect ‘calculation’ about the world.”

This is where computational psychiatry comes in. Sharp argues that the laws of the mind can be formulated through mathematical models. “What happens in the brain can only be explained if you take into account the person’s environment and situation.”

בכל צומת במבוך, הנבדק צריך לבחור – ימינה או שמאלה. כל בחירה מובילה להסתעפות חדשה At each junction in the maze, the participant must choose - right or left. Each choice leads to a new branch.

 

 

Seeing Thought in Real Time: The Quantum Sensor Revolution

Until recently, researchers faced two imperfect options for observing the brain in action. MRI provides detailed images of brain structure, but it’s slow and requires the subject to lie motionless inside a loud, confining tube. EEG (electrodes placed on the scalp), on the other hand, offers excellent temporal resolution but struggles to precisely localize where activity is occurring in the brain.

Enter OPM-MEG, short for Optically Pumped Magnetometers Magnetoencephalography, a next-generation technology. These are tiny quantum sensors embedded in a lightweight helmet that sits directly on the scalp. Here’s how it works: every thought we have is, at its core, an electrical current traveling between neurons. Each of these currents generates a minute magnetic field, and OPM-MEG sensors can detect those fields with extraordinary temporal resolution, down to milliseconds.

The real breakthrough is that, unlike older MEG systems, these sensors don’t require extreme cooling. That means they can be placed close to the head, allowing subjects to move, speak, and behave naturally during measurement. Sharp emphasizes why this matters: “Decision-making in real life is a dynamic process. When someone is stuck inside an MRI scanner, they’re not truly making decisions the way they would on the street or at home. With OPM-MEG, we can watch the brain ‘thinking’ in real time, in a natural setting.”

Computational Navigation: What Happens Inside the Anxious Brain’s Mental Maze?

One of the central tools Dr. Sharp uses with OPM-MEG is computerized mazes. For most of us, a maze might evoke a children’s game or a scene from a horror film, but for brain researchers, it’s a powerful instrument for measuring intelligence and planning.

Dr. Sharp uses these tasks to construct what he calls “maps of possibilities.” At each junction in the maze, the participant must choose – right or left – and each decision opens up a new branch. In mathematical terms, this forms a “decision tree.” By analyzing how individuals navigate the maze, researchers like Sharp can determine whether a participant is scanning multiple future possibilities, focusing only on the short term, or becoming trapped in repetitive loops of thought – cycles of worry that stall progress at a given point.

The maze, in essence, tests how the brain builds a cognitive map. With the help of OPM-MEG, Dr. Sharp can even detect signs that, as a participant stands at the maze’s entrance, their brain is already simulating possible paths forward, projecting ahead toward the longed-for “reward.”

In Dr. Sharp’s mazes, each station is marked by a distinct image. “With OPM-MEG, we can identify the specific electrical signature the brain produces when it sees an image of a tree, versus an image of a house within the maze,” he explains. “That means when a participant closes their eyes and thinks, we can infer which point in the maze they’re mentally occupying, even if they haven’t said a word. We can detect signs that they’re ‘navigating’ in their imagination toward the goal.”

In addition, using machine learning algorithms, Dr. Sharp is able to detect patterns in brain activity that form a unique signature for each individual. “We’ve seen cases where a participant’s brain didn’t activate certain regions of the experimental map, and when we later asked them to draw it, those areas were indeed missing. There’s a striking correlation between the subconscious processes we measure and what a person can later express in words or drawings.”

sharp-2.jpg “Two people with anxiety can have entirely different underlying mechanisms: one may struggle with planning the future, while another may struggle with uncertainty.”

 

 

Infinite Decision Trees: Anxiety as a Planning Failure

When we think about anxiety, we tend to think in terms of emotion. Dr. Sharp reframes anxiety entirely: it’s not just something we feel, but something that goes wrong in how the brain plans for the future. “An anxious person plans the future in a biased way,” he explains. “At every moment of decision-making, the brain constructs a ‘decision tree.’ In anxiety, the brain gets stuck in endless loops of simulating negative scenarios. It keeps scanning for threats, over and over again. That’s an enormous drain on cognitive resources. The brain invests tremendous effort in imagining uncertainty, and we experience that as pain – the ‘pain of worry.’”

Using mathematical models, Dr. Sharp can even estimate a subject’s emotional state. “Our models examine the mechanisms in the brain that are active when someone imagines or makes decisions, and try to understand why they’re doing it. If we know the value a person assigns to a particular option, the model can estimate the likelihood of their emotional response,” he says. “Two people with anxiety can have entirely different underlying mechanisms: one may struggle with planning the future, while another may struggle with uncertainty. Our models can measure that, and tailor treatment accordingly.”

Depression: When Goals Become a Trap

What happens in the brain of a depressed person when they receive a compliment? Dr. Sharp offers a striking explanation: “In depression, it’s clear that people don’t experience pleasure the way they once did. One theory centers on something fundamental called ‘reward sensitivity.’ In our models, it’s a parameter. If that parameter is disrupted, it can explain a great deal.”

“Humans have remarkable flexibility in how they interpret reward and punishment,” he continues. “Imagine you’re a child playing basketball and someone hits your arm. In a normal context, that feels like punishment. But if you’ve just moved to a new school where being pushed is seen as ‘tough’ and cool, that same physical stimulus can suddenly feel like a reward.”

In depression, that dynamic breaks down. “The brain may still register the reward, but it fails to update its goals or assign that reward meaningful weight in future decisions. It gets stuck in a calculation where nothing will improve, which leads to a sense of total despair.”

The Vision: Personalized Medicine Through a “Digital Blood Test”

As part of his work at the Dangoor Center for Personalized Medicine, Dr. Sharp aims to transform how psychiatric diagnoses are done. “Today, diagnosis is based on subjective questions,” he says, “but in 20 years, I hope we’ll have a far more precise system. The goal is to use computational tasks, a “digital blood test,” a 20-minute assessment in which patients make decisions to reveal their underlying mechanism.”

“This is part of what we call ‘natural neuroscience,’” he explains. “We can observe the brain in the act of planning. If someone says, ‘I’m stuck in a loop,’ we want to understand exactly what that loop is. Are they stuck because they can’t imagine future scenarios, or because they’re trying to account for every possible option?”

Asked about a moment when the science truly surprised him, Dr. Sharp points to the predictive power of mathematics. “We built a model to study how people plan steps within a map of possibilities. The mathematical theory suggested that if the brain starts by imagining the goal in the future and then plans backward toward the present – what we call backward planning – it’s far more computationally efficient.”

The surprise came when the model met reality in the lab. “We ran seven different experiments, and each time the results showed that people do in fact use this backward planning strategy. It was a real ‘wow’ moment – to see abstract mathematical laws explaining the subtleties of human thought.” The findings were published in Nature Human Behaviour, and the team is now working to observe this process unfolding in real time in the brain using OPM-MEG.

"זה היה רגע של 'וואו', לראות שחוקים מתמטיים מופשטים מסבירים את הדקויות של המחשבה האנושית" “It was a real ‘wow’ moment – to see abstract mathematical laws explaining the subtleties of human thought.”

 

The Pain of Uncertainty: Human Suffering as a Driver of Research

At the heart of Dr. Sharp’s work is a simple goal: to find better ways to reduce, or even prevent, human suffering. He recalls a formative and painful experience from his time as a clinical psychology doctoral student in the United States. “Human suffering is what drives me,” he says candidly. “When I was treating patients, I felt a very specific kind of suffering as a researcher – the suffering that comes from not having good answers. A patient comes in with depression, and we tell them, ‘Try this medication,’ knowing it only works in some cases, and that we don’t really understand why.”

For Dr. Sharp, that gap in scientific knowledge is a wound that remains open. “The patient suffers twice: from the depression itself, and from the uncertainty about what will actually help. The suffering I saw in my patients’ eyes – that’s my fuel. I can’t accept a reality where diagnosis is based largely on intuition.”

Dr. Sharp’s personal story is deeply intertwined with his work. He grew up in Philadelphia and moved to Israel in October 2024, in the midst of the war. “Despite the war, we wanted to be here. We were in New York, near Columbia University, and we were hearing shocking stories about antisemitism. Even friends I grew up with in Jewish schools suddenly think Israel is a terrorist state. That was very painful.”

The decision to come to Israel was also shaped by his wife’s family. “My wife’s sister is from Kfar Aza, and it was a miracle she wasn’t there that Saturday, on October 7. I saw how much my wife was suffering – she wanted to be here, and couldn’t bear being in the United States while there was a war here. Even during that year, we kept talking about it, planning our return.”

sharp-5.jpg Dr. Paul Sharp: “My models are not a substitute for the soul or for human connection; they are a way to deliver more precise help within this complex universe.” Photo: The Azrieli Foundation

 

 

Mathematics Is Not the Opposite of Emotion

When asked whether turning the mind into mathematics risks erasing our humanity, Dr. Sharp responds firmly: “I think the story is actually the opposite. We need to expand what we think mathematics is. We tend to see it as cold and detached from emotion, but it’s really the language that describes the universe – and our emotions are part of that universe.

“Mathematics doesn’t erase the mystery of life. Even if we had perfect models, there would always be uncertainty, because we simply don’t have enough material in the universe to compute every detail of a human life. My models are not a substitute for the soul or for human connection; they’re a way to provide more precise help within this complex universe. When you understand the underlying patterns of suffering, you can begin to truly heal it.”

Dr. Paul Sharp leads the Sharp Lab for Computational Mechanisms of Cognition and Psychopathology in the Department of Psychology and the Gonda Brain Research Center at Bar-Ilan University, and is a researcher at the Dangoor Center for Personalized Medicine.

Photo credit (main image): The Azrieli Foundation.

Last Updated Date : 15/06/2026