Maryam Mirzakhani, an Iranian mathematician who was the only woman ever to win a Fields Medal, the most prestigious honor in mathematics, died on Friday. 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.