In the Early Middle Ages, before the formation of the Islamic Empire, the world's biggest universities were run by the Buddhists, in India, at Nalanda, and in what is now Pakistan, at Taxila. In Egypt, the University of Alexandria remained an important center of learning, too. Most serious scholars went to one of these places, to work with other experts in mathematics, astronomy, or medicine.
But as the Islamic Empire grew richer, the Egyptian and Indian universities slowly grew poorer. Fewer and fewer people were Buddhists anymore, and after a while nobody lived in Alexandria anymore either. In the High Middle Ages, the Abbasid caliphs founded a new university at their new capital Baghdad, in what is now Iraq. Not to be outdone, the Umayyad caliph in Spain started another university at Cordoba, where many European scholars gathered. That's where Ibn Firnas succeeded in 875 AD in using a glider to fly down from a cliff (though he hurt his back when he landed). This was the first controlled human flight.
Gradually scholars moved westward towards Baghdad and Cordoba, bringing Indian scientific ideas with them. About 630 AD, people in the Islamic Empire began to use "Arabic" numbers, which really came from India. The Arabic word for numbers, in fact, is hindsah, which means "from India". Mathematicians found these new numbers very exciting for working with fractions and equations (ordinary people kept on using the Greek system of numbers for a while longer). The magnetic compass also came to the Islamic Empire from China, about 1100 AD, and made sailing easier in the Indian Ocean.
But Islamic scholars didn't get all their ideas from India and China. They read the Greek philosophers Plato and Aristotle, and the Roman encyclopedist Pliny the Elder, and they translated these books into Arabic. It was an exciting time: Islamic rulers had plenty of money to support research. Mixing Greek and Roman ideas with the knowledge of the Buddhist universities yielded a lot of new inventions and discoveries. For several hundred years, one Iranian scholar after another came up with new insights about the world. Islamic scientists, especially the Iranian Mohammed Al-Khwarizmi, combined the new numbers (and possibly the work of Greek mathematicians like Diophantus of Alexandria) with Euclid's geometry to develop algebra around 830 AD (The English word "algorithm" comes from Al-Khwarizmi).
It wasn't all math, either. About 800 AD, Central Asian food scientists bred novelty purple carrots, and a little later they developed the first lemons. About 850 AD, al Tabari worked in physics to expand on Aristotle's idea that we saw things because light bounced off objects into our eyes. Al Tabari's student, al Razi, figured out that smallpox and measles were different diseases, and that fevers are not illnesses, but a way for your body to cure an illness. Ibn Sahl, working in Baghdad, improved on Roman glass-blowing to make the first curved glass mirrors that concentrated sunlight to focus heat. About 1000 AD, Ibn Sina also worked in physics, coming closer to figuring out Newton's Laws of Motion. Ibn Sina also figured out that you could catch diseases from other people. Astronomers were beginning to say that the Milky Way was made up of thousands of stars, and even to identify other galaxies.
About 1100 AD, al Ghazali argued that Ibn Sina's laws of nature were really just the hand of God. Al Ghazali also worked to explain eclipses. Then in the 1200s AD, teachers who had learned science from Ibn Sina's students taught Nasir al Tusi. Al Tusi became an astronomer, working on the question of whether the earth went around the sun.
By this time, new universities were springing up all across North Africa as the Muslim and Jewish scholars of Cordoba fled the Reconquista and settled in Cairo, Tunis and Morocco. In Cairo in the 1100s AD, Maimonides suggested that clean air and water would help keep you from catching diseases, and worked to develop scientific method for experiments. About the same time, Ibn Bajjah in Morocco worked on the sexual reproduction of plants, and al Idrisi produced a good map of the known world. Ibn Battuta, originally from Morocco, wound up teaching and doing research in the Delhi Sultanate in India for seven years in the 1300s, before returning to Morocco in middle age and working there. In Tunis, about 1400 AD, Ibn Khaldun wrote his History of the World.
But by al Tusi's time, the Mongol invasions disrupted scholarship in the Islamic Empire. Some, like al Tusi himself, found Mongol patrons for their research. Others, like Ibn Battuta, found work in India. But Central Asia, West Asia and North Africa were getting poorer, and European countries were getting richer and more peaceful as successful rulers conquered their neighbors. By the Late Middle Ages, new universities were opening in Europe. In the Islamic kingdoms, fewer smart children got good educations, and even fewer could find support for their research once they grew up.