It’s been a rough couple of centuries for Jeremy Bentham. When he died in 1832, he was perhaps the most famous moral philosopher in the English-speaking world. But the further people looked into his ideas, the more implausible they seemed. Within a few decades he was more of a laughingstock than a source of enlightenment.

And it’s easy to see why. Bentham not only believed that pleasure and pain were the one true standard for assessing right and wrong, but also that they could be measured precisely, in an algorithm known as the “philosophic calculus,” and counted out in units called hedons, dolors and utils. The greater the proportion of hedons, the happier you would be. This was as true of communities, Bentham wrote, as it was of individuals. The basic task for community leaders, then, was to get the hedon count up.

Bentham seemed to conflate transitory pleasure and enduring happiness. No modern moralist would do that. But in dismissing Bentham’s bizarre calculus, generations of moral thinkers also dismissed a reasonable premise: the idea that it might be possible in some way for a community to gauge the overall happiness of its inhabitants.

This was about where things stood 30 years ago, when Richard Layard, a British economist now ennobled as Baron Layard of Highgate, began promoting a radical doctrine. Maybe, he posited, the time had come to take Bentham seriously again.

Layard’s work stemmed from research that showed that rising incomes didn’t make people any happier. Follow this out, Layard said without embarrassment, and the road leads straight to Bentham. “I believe that Bentham’s idea was right,” Layard wrote in 2005, “and that we should fearlessly adopt it and apply it to our lives. The right action is the one that produces the greatest happiness in the world.”

At first, most social scientists found Layard almost as fuzzy a thinker as his long-discredited hero. But in the last quarter century, respectable research started to point in Layard’s direction -- and offer evidence that happiness might, indeed, be a measurable commodity. Some of it was brain research: By the late 20th century, it was well-established that specific areas of the human brain, and specific neural chemicals such as dopamine and oxytocin, were correlated with heightened feelings of well-being. The neurology of happiness became a legitimate subject of research.

Then came behavioral economics, the branch of social studies that uses controlled experiments to learn how people make decisions and why so many seemingly rational choices lead to sadness rather than contentment. Behavioral scientists such as Harvard University’s Daniel Gilbert argued that while people know whether they are happy at a given moment, they are largely incompetent when it comes to predicting what will make them happy in the future. It was quite plausible that measuring people’s happiness and helping them approach the future more intelligently was a task that clinicians and educators -- and even governments -- might reasonably undertake.

The result has been systematic efforts to apply Bentham and Layard’s philosophy in diverse parts of the world. The tiny nation of Bhutan, for example, began measuring its “gross national happiness” and looking for ways to increase it. The World Values Survey and the Gallup World Poll include questions on the subject. And David Cameron, when he became Britain’s prime minister in 2010, conferred with Layard and other happiness scientists about how to apply their work.

It was only a matter of time before a government somewhere in America ventured into the same territory. This happened in 2011 in Somerville, Mass. That year, residents of the Boston suburb opened their periodic survey from the mayor’s office and found something they had never seen before. The survey asked, “How happy do you feel right now?” And, “How satisfied are you with your life in general?” The 10 response choices ranged from “very unhappy” to “very happy.” The median response was a relatively encouraging 7.7, as one might expect in a community that was in the midst of a transformation from industrial-era doldrums to gentrified affluence. Consistent with academic research in the new field of happiness science, Somerville learned that there was relatively little correlation between people’s income levels and their perception of personal well-being.

In two subsequent surveys, the happiness number in Somerville has remained very close to the original level: It was 7.8 in 2015, the most recent survey for which results have been tabulated. Taken alone, it didn’t offer any direction at all for public policy. But some of the more specific responses did. Somerville found that its residents were least happy when they thought about the “beauty or physical setting” of the place where they lived. It was a logical response in a gritty old blue-collar suburb, even one that was rapidly getting spruced up. But it was also useful information that pointed to the need for a little more public emphasis on aesthetics. What was the government doing that made citizens really unhappy? Forcing them to sort their garbage into separate bins for recycling. That requirement came to an end.

Just as Somerville was embarking on the third round of its happiness inquiry, an even more ambitious effort was getting started all the way on the other side of the country. Santa Monica, Calif., the affluent Los Angeles suburb on the Pacific Ocean, launched the Wellbeing Project with the help of a $1 million grant from Bloomberg Philanthropies. While Somerville’s survey focused on just a few hundred randomly selected households, Santa Monica’s outreach was larger and received 3,800 responses. A few months ago, the city published the second edition of its probe into civic well-being.

The two places have relatively little in common, but their survey results are similar. This year, Santa Monica came in at 7.4 on the happiness scale. Most of its numbers seemed to suggest a contented city. Some 69 percent of its respondents reported that they were happy most or all of the time; 90 percent said they were never or rarely lonely; 80 percent said daily life was worthwhile. White residents actually reported less happiness than minorities, but they were also more likely to report that they were “living the best life possible.”

How radical a departure are Somerville and Santa Monica making from what other cities do? In some ways, only a modest one. In both places, the questions about personal well-being are part of a larger survey that asks the standard questions about consumer satisfaction with local government. The questions cover topics like street and sidewalk maintenance and the quality of the public schools.

But when a resident of either of these cities opens up the questionnaire and is confronted with “how happy do you feel right now?” and “how satisfied are you with your life?,” there is no way to hide the fact that something is going on. These may be customer surveys, but they are also existential inquiries. The question is whether happiness and well-being are subjects that local governments should be diving into.

To most traditional economists, the answer is no. Citizens express their preferences and desires in the decisions they make every day. They buy the commodities they desire and sell the ones they don’t want. Ordinary economic transactions are all the information any community needs to determine what makes its inhabitants satisfied.

This might have been a compelling objection 30 years ago, before behavioral economics began turning up evidence that all of us make terrible choices, misjudging what will bring us happiness and then living with the unpleasant consequences for the rest of our lives. It may be useful to know that people are purchasing remote McMansions that force them to commute in traffic three hours a day. But it’s equally useful to ask how much satisfaction those purchases give them 10 years later.

Beyond the economists’ objections, there’s the libertarian argument that governments have no business quizzing constituents about their state of mind. To a true-believing libertarian, happiness surveys have a dystopian quality about them, faintly reminiscent of science fiction societies in which drugs are used to make people placidly content with life under an autocratic regime. If the happiness count dips too low, an ambitious dictator sometime in the future might decide to experiment with a pharmacological solution.

Personally, I’m not too worried about that. The problem with gauging happiness isn’t that an unscrupulous politician might try to manipulate it, but that we still know next to nothing about how to enhance it. Somerville learned from its survey that homeowners are happier when they don’t have to sort their garbage. That’s worth knowing, but on a scale of existential insights, it doesn’t rank very high. As Somerville’s survey director remarked a couple of years ago, “One of the biggest lessons is just how nebulous a concept happiness is, and how difficult it really is to influence through policy. … It’s easier to measure than to manage.”

There is, however, one reason for measuring happiness that genuinely makes sense. It gives us numbers to place alongside the long list of dubious statistics that we use every day to try to assess which places and policies in this country are meeting with success. We judge states and localities according to how many jobs they are creating, how fast the population is growing, whether productivity is rising or falling, and by a whole array of other yardsticks that tell us very little about the inner lives of the people who reside there. In 2016, we didn’t really understand the sense of desperation in blue-collar and small-town America until it made its feelings clear in the presidential election. The economic data didn’t tell us what was important. A few well-chosen questions about happiness might have.