In 2014 Mirzakhani was one of four winners of the Fields Medal, which is presented every four years and is considered the mathematics equivalent of the Nobel Prize. She was named for her work on complex geometry and dynamic systems.

"Mirzakhani specialized in theoretical mathematics that read like a foreign language by those outside of mathematics: moduli spaces, Teichmüller theory, hyperbolic geometry, Ergodic theory and symplectic geometry," according to the Stanford press announcement. "Mastering these approaches allowed Mirzakhani to pursue her fascination for describing the geometric and dynamic complexities of curved surfaces_spheres, doughnut shapes and even amoebas - in as great detail as possible."

The work had implications in fields ranging from cryptography to "the theoretical physics of how the universe came to exist," the university said.

Mirzakhani was born in Tehran, Iran, and studied there and at Harvard University. She joined Stanford as a mathematics professor in 2008.

Iran's foreign minister, Mohammad Javad Zarif, said her death pained all Iranians, the Tehran Times reported.

"The news of young Iranian genius and math professor Maryam Mirzakhani's passing has brought a deep pang of sorrow to me and all Iranians who are proud of their eminent and distinguished scientists," Zarif posted in Farsi on his Instagram account. "I do offer my heartfelt condolences upon the passing of this lady scientist to all Iranians worldwide, her grieving family and the scientific community."

Mirzakhani originally dreamed of becoming a writer but then shifted to mathematics.

When she was working, Mirzakhani would doodle on sheets of paper and scribble formulas on the edges of her drawings, leading her daughter to describe the work as painting, according to the Stanford statement.

Mirzakhani once described her work as "like being lost in a jungle and trying to use all the knowledge that you can gather to come up with some new tricks, and with some luck you might find a way out."

Stanford President Marc Tessier-Lavigne called Mirzakhani a brilliant theorist who made enduring contributions and inspired thousands of women to pursue math and science.

Mirzakhani is survived by her husband, Jan Vondrák, and daughter, Anahita.