For the mathematician Sarah Hart, a close reading of “Moby-Dick” reveals not merely (per D.H. Lawrence) “one of the strangest and most wonderful books in the world” and “the greatest book of the sea ever written,” but also a work awash in mathematical metaphors.

“Herman Melville, he really liked mathematics — you can see it in his books,” said Dr. Hart, a professor at Birkbeck, University of London, during a February talk on “Mathematical Journeys into Fictional Worlds.”

“When he’s reaching for an allusion or a metaphor, he’ll often pick a mathematical one,” she said. “‘Moby-Dick’ has loads of lovely juicy mathematics in it.”

Near the beginning of the story, Ishmael, the narrator, describes the stingy landlord and his wares at Spouter-Inn: “Abominable are the tumblers into which he pours his poison. Though true cylinders without — within, the villainous green goggling glasses deceitfully tapered downward to a cheating bottom. Parallel meridians rudely pecked into the glass, surround these footpads’ goblets.”

And at the end, Captain Ahab praises the loyal cabin boy, Pip, with geometry: “True art thou, lad, as the circumference to its center.”

Dr. Hart explored this subject further with a paper, “Ahab’s Arithmetic: The Mathematics of Moby-Dick,” recently published in the Journal of Humanistic Mathematics. The quantity and sophistication of Melville’s mathematical allusions, she argued, were evidence of his high level of knowledge and ability, which she attributed to an “unusually good mathematical education.” She concluded that Melville “actively enjoyed mathematics and mathematical ideas, and that this shines through in his work.”

### Taking ideas for a walk

An exuberant enthusiasm for mathematics (and life in general) shines through Dr. Hart. Her talk in February was the latest in a series she is delivering on mathematical intersections in literature and music, presented online by Gresham College in London. Last spring, she was appointed the Gresham professor of geometry; established in 1597, it is the oldest mathematical chair in England. Dr. Hart is the 33rd person to hold the position, and the first woman.

As she explained in her Gresham application, a key motivator of her interest in that position and, about 15 years earlier, in joining the faculty of Birkbeck — a college offering working Londoners evening courses — was that “at the heart of both organizations is something to which I am deeply committed: giving people from all backgrounds access to education and learning.”

Dr. Hart considers the twin vocations of her career to be researching mathematics (she specializes in group theory, the mathematics of symmetry) and communicating mathematics (she once gave a talk to 900 students on “How to Prove Absolutely Anything”).

The daughter of two schoolteachers with mathematics degrees, Dr. Hart first became aware of the Gresham professorship when she was a high school student. In 1993, Sir Christopher Zeeman held the position and she attended his Gresham lecture on the mathematics of dressmaking.

The Gresham brief entails 18 public lectures, six each year over three years. Dr. Hart chose the theme “Mathematics, Culture and Creativity.” The broad perspective allowed her curiosity a wide berth. Writing the scripts, she invariably ends up with twice as much material than would fit into 60 minutes.

“I am pathologically interested in everything,” she said from her home in Walthamstow, in East London. During lockdown, “everything” grew to include dabbling in lessons with her daughters, ages 10 and 14, on, among other things, palindromic numbers, origami, code cracking, geometric patterns, etymology and Latin.

Basically, Dr. Hart just likes playing. “Was it Paul Klee who talked about ‘taking a line for a walk’?” she said. “I like to take an idea for a walk.”

### Mathematical melodies

An especially thrilling aspect of the Gresham appointment for Dr. Hart is the history. (She is president of the British Society for the History of Mathematics.) While writing her second lecture, on the mathematics of sound, she came across an apropos entry in Samuel Pepys’s diary for April 1668: He went to King’s Head tavern near Gresham College, where he drank and ate and talked — and “above the rest,” heard from William Brouncker, the first president of the Royal Society, and Robert Hooke, then the Gresham professor of geometry, “an account of the reason of concords and discords in musique, which they say is from the equality of vibrations.”

Dr. Hart’s Gresham series debuted last fall with her lecture on the use of mathematical patterns and structures in music — for instance, with fractal compositions. The defining characteristic of a fractal, such as the Mandelbrot set, “is self-similarity,” Dr. Hart said.

“As you zoom in and in and in, you get the same pattern repeating again and again, at smaller scales,” she said. Consider the recursive structure of fern fronds, or a coastline from above. Fractal music also displays self-similarity at varying scales, but applied to, say, pitch and tempo. The Finnish composer Kaija Saariaho used a fractal generator in her composition Nymphéa for a string quartet; computer-calculated rhythmic and melodic motifs gradually transform, recurring again and again.

Dr. Hart also investigated the use of group theory and symmetry as a creative device in musical composition. The violin duet attributed to Mozart, “Der Spiegel” (“The Mirror”), demonstrates rotational symmetry. It is played simultaneously by two violinists, sitting across a table and looking at the same score; one plays from the beginning to the end, the other plays from the end to the beginning. “So the notes played by the first player are the same as those played by the second, except rotated through 180 degrees,” Dr. Hart said.

She also touched on probability and randomness, noting an 18th-century Italian musical board game that promised “un infinito numero di minuette trio.” The object of the game: Players compose a 16-bar minuet by rolling a die and then choosing, bar by bar, which of six musical options, composed by Haydn, should come next.

But she disproved the claim that there are infinitely many minuets to be composed in this way. Assuming all Haydn’s composed bars were different, there would be 16 consecutive choices from six options, producing only 6¹⁶ possible minuets. Dr. Hart noticed that Haydn used the same final bar in four of his six pieces, and the same eighth bar in three: “Somebody got a bit lazy,” she said. So in fact, the exact number of possibilities is 6¹⁴ × 4 × 3 = 940,369,969,152 — or just shy of a trillion.

But who’s counting (aside from Dr. Hart).

### ‘A dose of mathematics every day’

For Dr. Hart’s next installment, on Tuesday, she considers applications of mathematical structures in literature, including the Oulipo group of French mathematicians and writers; the mathematically-minded Argentine writer Jorge Luis Borges and his short story “The Library of Babel”; and Michael Crichton’s “Jurassic Park.”

She also discusses “The Luminaries,” by Eleanor Catton, winner of the 2013 Booker Prize. Every year, Dr. Hart and a friend speed-read the shortlist. That year, once she got three-quarters of the way through “The Luminaries,” she realized there was something mathematical going on: The chapters displayed a geometric progression, halving in length one to the next. She also noticed “a twelveness happening” — there are 12 chapters, and 12 signs of the zodiac each instantiated in one of the main characters.

The structure, by Dr. Hart’s reading, had a compelling effect. “It’s refining and refining and refining, gradually waning down, until it’s quite poignant by the end,” she said; the two main characters, the luminaries, seem trapped in their destinies. “It’s a feeling of inevitability, closing in the kernel of the love story at the center of the entire novel.”

Such constraints and structures are most successful when not imposed frivolously, she added: “That’s not what it’s about. And that’s not what mathematicians do. We don’t invent a structure for no reason, like some silly intellectual game. We find structures lying around, and we explore them.”

Last term at Birkbeck, Dr. Hart taught the first module of a course called Explorations in Mathematics, giving students a taste of real mathematical research, which entails becoming comfortable with uncertainty.

“Real mathematics involves not knowing what is going on, not having any idea what to do, and then playing around and hopefully finding your way through,” she said.

Finding the way often involves imposing structures and constraints on a problem. The tension, Dr. Hart said, is between wanting the most general result possible and actually being able to prove something. “You could prove hundreds of rubbish theorems about your very precise special case, but nobody would care because it has no wider implications or applications,” she said. “You want just enough structure to hang your ideas on, but not so much that you are boxed in.”

Among all the literary works she considered for the Gresham lectures, her favorite is “Moby-Dick.” Melville’s choicest mathematical allusion is perhaps found in his description of the large whaling “try pots.” The pots were so large that sailors “coil themselves away there for a nap” and they were also a nice place for “profound mathematical meditation.” As Ishmael observed, “It was in the left hand try-pot of the Pequod, with the soapstone diligently circling round me, that I was first indirectly struck by the remarkable fact, that in geometry all bodies gliding along the cycloid, my soapstone for example, will descend from any point in precisely the same time.”

Dr. Hart observed: “I think that’s Melville saying, ‘I know some geometry,’ because that’s a famous problem. It’s the so-called tautochrone problem, to find the curve for which the time taken by a frictionless object sliding under gravity to the lowest point of the curve is independent of the starting point.”

That curve, called a cycloid, is produced by a point on the circumference of a circle or wheel as it rolls along a straight line. “Melville just throws that in,” Dr. Hart said.

She is also enamored of the mathematical allusions applied by George Eliot (the pen name of Mary Ann Evans). Eliot, in her first novel, observed that Adam Bede seems “to find reassurance in the eternal truth of mathematics, consoling himself after his father’s death with the thought that ‘the square o’ four is sixteen, and you must lengthen your lever in proportion to your weight, is as true when a man’s miserable as when he’s happy.’”

Eliot also seemed to take solace from her own mathematical literacy. In 1849 Eliot, in “want of health,” described in a letter how she sustained herself: “I take walks, play on the piano, read Voltaire, talk to my friends, and just take a dose of mathematics every day to prevent my brain from becoming quite soft.”

Dr. Hart said: “Everybody should!”