We did this to ourselves, San Francisco. Now we have to...

Back when I was about 16 and knew just about everything, I took a class in physics. The teacher started off with some basics. “For every action there is an equal reaction,” he said. That meant, he claimed, that there were consequences for everything you did. I didn’t believe him. Neither did my friends. We were young and free as the wind. That teacher was old, ancient. He must have been 40 at least, maybe 45. What did he know?

As a consequence of getting older myself, I now see what he meant. Take our beloved — and maddening — city of San Francisco, for example. For years we have prided ourselves on being a place where anything goes. Anybody could come here and reinvent themselves. It was part of our DNA. “San Francisco is a mad city, inhabited for the most part by perfectly insane people ...” Rudyard Kipling said more than a century ago. We loved that quote. In fact it’s inscribed on a railing on the waterfront along with other quotes from notable persons praising the city by the bay.

For years we tolerated, even encouraged, street characters, believing them to be part of the elusive essence of San Francisco. But now the streets, particularly Market Street — the city’s main stem — are clogged with what appear to be truly mad people, talking to themselves, shouting.

Why? Because the community made a decision to allow untreated public mental illness. If questioned about it, many civic leaders will trace the problem to Ronald Reagan, who as governor decided to close mental hospitals and treat mental illness in community centers. Reagan left the governor’s office nearly 50 years ago, but we are still feeling the consequences of that decision.

In a celebrated decision known as the Freeway Revolt many years ago, San Franciscans decided not to build more freeways in the city. Now the streets are gridlocked at rush hour.

Some consequences had good results: Tearing down the Embarcadero Freeway opened up the waterfront and gave new life to the neglected Ferry Building. But there were other reactions. Chinatown leaders claimed that tearing down the Embarcadero Freeway hurt business in their neighborhood, so they extracted a political price: a 1.7-mile Central Subway.

The consequences of that were remarkable. The first was a huge cost overrun. The original estimate of $530 million has risen to $1.5 billion amid long delays. The Central Subway has been under construction for nine years now. It has taken twice as long to build as the Golden Gate Bridge. And the Central Subway won’t be finished until 2021. The year after next.

Some San Francisco decisions are more subtle. We have decided to let things slide. The Central Subway is one example. Another is the Van Ness Avenue bus project. Van Ness has been a mess since work began three years ago. The aim is to redesign the street so that buses, Muni and Golden Gate Transit will be able to save about five minutes per trip. It will be finished, they say, in that magic year of 2021.

We have also decided to enforce the laws selectively. There seem to be no consequences for drug dealing, but parking in a tow-away zone gets you a huge fine.

Some decisions have turned out well. For example, when the Army pulled out of the Presidio, the citizens decided the best use of the huge old military post was as a mixed-use park instead of housing. But even that decision had consequences: San Francisco now has a housing crisis created in part by a principle of economics. Scarcity drives prices higher.

The median price of a house in San Francisco is $1.6 million, but only 47% of San Franciscans are homeowners. The rest are renters, and the average rent in the city is $3,706 a month. If you want a studio, the average is $2,500 a month. That’s $30,000 a year.

Or you can rent a shared room at Post and Hyde streets in a building owned by an outfit called PodShare. It’s a bit like a dorm, or an Army barracks. You get a small television, access to a bathroom and shower. The price: $1,200 a month.

So here’s the deal: If you were lucky enough to buy a house in San Francisco, you are rich. But if you sell the place and move away, you can’t move back. And if you are an ordinary young person hoping to live in this lovely city, you are out of luck.

We’re the city where anything goes, but maybe we’ve gone too far. We’ve made a lot of decisions that have kept this city beautiful but made it unlivable and unaffordable at the same time. And now we have to live with the consequences.

Carl Nolte’s column appears Sundays. Email: cnolte@sfchronicle.com Twitter: @carlnoltesf