He sometimes writes because he’s asked to — perhaps a commencement address for Brandeis University, a review for The New York Times of a Harriet Beecher Stowe biography or reflections on the U.S. Constitution, as requested by the Pennsylvania Humanities Council.

Doctorow’s novels, from “Ragtime” and “Loon Lake” to the new release, “Andrew’s Brain,” begin more mysteriously.

“I discovered Einstein said the same thing about his celebrated theories of relativity that writers say about their work when he said he didn’t have any feelings of personal possession of these ideas. Once they were out there, they came from somewhere else,” Doctorow, 83, said during a recent interview at his office in downtown Manhattan, where he is a faculty member at New York University.

“And that’s exactly the feeling when you write. You don’t feel possessive about it. You’ve discovered something. You didn’t do it, you discovered it, even if it’s you that have been writing it.”

“Andrew’s Brain” is an invention of the mind and about the mind, the follies and revelations of a middle-aged cognitive science professor who mingles with the famous — or so he says — makes a tragedy of his personal life, worries about the world and thinks often about why he thinks.

Doctorow began the book with two random images.

“The first of a child, a little girl, drawing with her colored pencils, and then an adult sees what she’s doing and she takes a pencil and scribbles over what she’s been drawing so carefully. I don’t know why that particular image impressed me so,” Doctorow says.

“And then I put it together with a memory I had of a man I worked for many years ago, as a reader for a motion picture company, a decent, wonderful man. He said he had inadvertently murdered his infant child by feeding it the wrong medicine, an infant with an eyedropper. And he had done this, and he was what I would call an inadvertent agent of disaster.”

Andrew’s wife has left him after the death of their child, and he has fallen in love with a student less than half his age. Structured like a rambling confession, the life of a mind, the narrative shifts between third and first person, past and present, the everyday and the improbable.

The difference between nonfiction and fiction is, for Doctorow, the difference between control and surrender. He finds himself following his literary characters, wondering what they’ll do or where they’ll turn up next. Andrew’s travels include a house in suburban New Rochelle (Doctorow’s former residency, and the primary setting for “Ragtime”), a Pennsylvania farm where a little girl defaces her drawing and an interlude in Washington, D.C., with a president who very much resembles George W. Bush.

The new novel also takes on the ongoing debates about science versus literature and humans versus machines. Doctorow is a partisan, with a point of view he made clear last fall during his acceptance speech at the National Book Awards ceremony, where he was presented an honorary prize.

Doctorow, the very image of a reflective man with his high forehead and soft goatee, dedicated much of his talk to technology and its potential threats to privacy and creative freedom. During his recent interview, a Dell computer on his desk, Doctorow notes that while researching “Andrew’s Brain” he read about scientists attempting to solve the ancient riddle of human thought.

“If we ever find out how the brain works, with all its complexity, then we will be able to build a machine that has consciousness,” Doctorow says. “And if that happens, that is a road to planetary disaster, because everything we’ve thought about ourselves, since the Bronze Age, the Bible, all of that will be gone.”

Doctorow, a native of New York City, has always had an intimate relationship with books, imagining as a boy that he was writing the stories while he was reading them. He published sporadically in his 20s and 30s — a novel “Welcome to Hard Times,” a Western, was released in 1960; a science fiction novel, “Big as Life,” came out in 1966 and is long out of print, a fate Doctorow has never regretted.

His breakthrough, the Cold War story “The Book of Daniel,” came out in 1971. The novel established him as a major literary voice, but for a time left him exhausted.

“I had been writing for a year and kept writing something and nothing worked. And so I was sitting on the third floor of 170 Broadview Ave. (in New Rochelle) looking at the wall,” he says. “And I started to write about the wall and then the house that was built in 1902 and then what things looked like in New Rochelle and how people dressed and the trolley cars.