Maryam Mirzakhani, an Iranian mathematician who was the only woman ever to win a Fields Medal, the most prestigious honor in mathematics, died on Saturday. She was 40.

The cause was breast cancer, said Stanford University, where she was a professor. The university did not say where she died.

Her death is “a big loss and shock to the mathematical community worldwide,” said Peter C. Sarnak, a mathematician at Princeton University and the Institute for Advanced Study.

The Fields Medal, established in 1936, is often described as the Nobel Prize of mathematics. But unlike the Nobels, the Fields are bestowed only on people aged 40 or younger, not just to honor their accomplishments but also to predict future mathematical triumphs. The Fields are awarded every four years, with up to four mathematicians chosen at a time.

“She was in the midst of doing fantastic work,” Dr. Sarnak said. “Not only did she solve many problems; in solving problems, she developed tools that are now the bread and butter of people working in the field.”

Dr. Mirzakhani was one of four Fields winners in 2014, at the International Congress of Mathematicians in South Korea. Until then, all 52 recipients had been men. She was also the only Iranian ever to win the award.

What a goddam waste.

Dr. Mirzakhani’s mathematics looked at the interplay of dynamics and geometry, in some ways a more complicated version of billiards, with balls bouncing from one side to another of a rectangular billiards table eternally.

A ball’s path can sometimes be a repeating pattern. A simple example is a ball that hits a side at a right angle. It would then bounce back and forth in a line forever, never moving to any other part of the table.

But if a ball bounced at an angle, its trajectory would be more intricate, often covering the entire table.

“You want to see the trajectory of the ball,” Dr. Mirzakhani explained in a video produced by the Simons Foundation and the International Mathematical Union to profile the 2014 Fields winners. “Would it cover all your billiard table? Can you find closed billiards paths? And interestingly enough, this is an open question in general.”

Apparently some Iranian newspapers used the occasion of her death to show her bareheaded. I wish I could call that progress, but ordinary women are still hounded by the religious police… and tomorrow they’ll resume hanging gays.

The love of my life was similarly cut down by the same ailment (for some values of ‘the same’, since breast cancer has a whole host of causes from different tissues), and at a similar age. She too was brilliant, in history rather than mathematics, though she had the kind of general intelligence that could have been applied to any field she chose to study. It was a tragedy and a waste, for her family, for me, for the world, and for herself.

But she, and Maryam, both touched countless lives; and though my love was not renowned (at least as much by her own choice as her circumstances), Maryam’s life will stand as an example to budding mathematicians and women for generations. That is something to salvage from the waste.