Like humans with a nose for the best restaurants, roundworms also use their senses of taste and smell to navigate. And now, researchers may have found how a worm's brain does this: It performs calculus.

Worms calculate how much the strength of different tastes is changing — equivalent to the process of taking a derivative in calculus — to figure out if they are on their way toward food or should change direction and look elsewhere, says University of Oregon biologist Shawn Lockery, who thinks humans and other animals do the same thing.

This research could one day benefit some of the more than 200,000 Americans who detect a foul smell or taste that is actually pleasant or have a weakened or depleted ability to appreciate the scent of a lilac or savor the flavor of a juicy burger.

"The more we know about how taste and smell function — not just at the level of primary sensory neurons, but downstream in the brain — the better prepared we will be to understand when the system is broken," Lockery says.

With the aid of salt and chili peppers, Lockery reached the calculating-worms conclusion by studying two anatomically identical neurons from the worm's brain that collectively regulate behavior. These two neurons function like "on" and "off" gates in a computer in response to changes in salt concentration levels. This dubiously delicious discovery, detailed in the July 3 issue of the journal Nature, hints at the method for smelling and tasting that is thought to be common among a wide variety of species, including humans.

Like human visual systems that respond to the presence and absence of light, Lockery and colleagues found that when the left neuron fires as salt concentrations increase, the roundworm continues crawling in the same direction. The right neuron responds when salt concentrations decrease, and the worm turns in search of a saltier location.

Lockery said this is similar to a game of hot-and-cold with a child. But there is one key difference: the worm doesn't need an observer to say if it's getting closer to or farther from the target — the worm calculates the change by itself.

Observing the worm responding to changes in concentration suggested an experiment to see if the worm's brain computes derivatives. The mathematical concept of a derivative indicates the rate at which something, such as salt concentration, changes at a given point in time and space. So Lockery tried to verify that these neurons recognize changes in salt concentration and then tell the worm where food is and where it is not.

To do so, he artificially activated each neuron with capsaicin, the spicy component in chili peppers, which worms naturally cannot detect. Worms with capsaicin applied to the left neuron crawled forward. When the worm's brain indicated that the current motion leads to increasing salt concentrations, it continues moving in its original direction. But when the worm's right neuron is activated by capsaicin, it is duped into thinking the salt levels are decreasing. So the worm changes direction, hoping to find salt elsewhere.

"We found a new way to do calculus with neurons," Lockery told LiveScience.

Previous studies have identified "on" and "off" cells in the brains of other chemosensory animals such as fruit flies, cockroaches, frogs, lobsters and rats. Given the strong similarities between the olfactory regions of the brains in rats and other mammals, Lockery says that humans should also be included in this list. So his work suggests that this circuit may be a universal derivative for smelling and tasting.

In response to the lingering mystery of why worms go toward salts in search of food, Lockery offers an untested theory that the decaying carcasses of invertebrates, like snails and earthworms, provide a common source of bacteria. Since animals are very salty inside, he thinks there could be a link between salt and bacteria in the wild.