Marrakech became, due to the ambitions and sponsorship of its rulers, the centre of attraction for numerous scholars including Ibn Rushd who served as the Chief Physician and where he pursued many works in science. This is a glimpse into the important role of Marrakech in Islamic science.
Marrakech was founded in about 1070 CE by the Almoravids. The city became the capital of the empire which was in the Sahara as well as the Maghrib. It was strategically placed on the plain of the Tensift River, just within the arc of the Atlas Mountains at the convergence of two major routes across the mountains. In 1147 Marrakech fell to the Almohads of the High Atlas, who made it their own capital. Even when the capital was later moved to Seville, the city was the centre of the Almohad community with its scholars and military. Marrakech became, due to the ambitions and sponsorship of its rulers, the centre of attraction for Maghribi scholars and even a certain number from Spain. In 1153 Ibn Rushd became engaged in astronomical observations in Marrakech. In 1163 he became associated with the Almohad court; the philosopher Ibn Tufayl (1105-1185) introducing him to the Almohad ruler, Abu Yaqub, who was greatly interested in philosophy. Ibn Tufayl recommended Ibn Rushd for this task.
The love of books is as strong in the Maghrib (literally "the west") as in the Machrek (the east). Marrakech is known for the Kutubiya Mosque which is famed for its books, manuscripts, libraries and book shops, all of which gave the mosque its name. The Kutubiya with its hundred or so book sellers gathered in the shade of the minaret, and the many intermediaries who rushed between places searching for rare and new manuscripts to copy; and also the dallals (traders) who bought and sold ancient works from and to the scholars of the city. The sultans themselves collected both works and their authors, whom they wanted to have very close to them. In Marrakech there was also a great tradition of constructors of astrolabes,  Detailed information on such people and their accomplishments can be found in Mayer.
Many historians flourished in Marrakech, most living in close proximity to the Caliphs, such as Abu Bakr al-Sanhadji, who wrote extensively on the Almohads, and whose works were traced by Levi Provencal to the Spanish collection at the Escorial. Because he observed the events from close at hand, what he describes bears the stamp of authenticity on the Almohad movement in history. Another historian born in Marrakech in 1185, but who studied at Fes, was Abd al-Wahid al-Marakushi. In about 1224, he wrote his Kitab al-Mujib fi talkhis akhbar al-Maghrib, which is a good personal account of the history of the Western Maghrib; many details found in the work are unique in their genre.
One of the greatest accomplishments of Almohad rule was the Marrakech hospital, also called the Bimaristan of Amir al-Muminin al-Mansur Abu Yusuf. Al-Mansur ruled Morocco from 1184 until his death in 1199. Abu Yusuf ordered the masons and the builders to carry out his plans to the highest standard. He decorated the hospital with inscriptions and designs of exceptional beauty. He ordered that flowers should be planted and cultivated in the courtyard, as well as fruit trees, and to have flowing water conducted to all the wards and rooms. He ordered the hospital to be equipped with furniture and to be covered with tapestries of wool, linen and silk, which gave an indescribable richness. He endowed it with ample waqfs and donations, providing the hospital with a daily sum of forty dinars for its expenses.
Two great scientists repute had links with Marrakech: Ibn Rushd and the mathematician Al-Marrakushi.
Ibn Rushd was born in 1126 in Cordoba into a family of learning and culture; both his father and grandfather were distinguished judges. In 1153, he was in Marrakech engaged in astronomical observations. Ibn Rushd succeeded Ibn Tufayl as chief physician in 1182 and served Abu Ya'qub Yusuf until the latter's death in 1184. He then served his son and successor, Ya'qub al-Mansur. Although engaged in astronomical observations in Marrakech, and his scientific treatise on the motion of the sphere (Kitab fi harakat al-falak), Ibn Rushd is best known for his very influential medical work, Kitab al-kulliyat fil-tibb (hence the Latin name Colliget from al-Kulliyyat (The generalities). It was written before 1162, in seven books treating respectively of anatomy, health (physiology), general pathology, diagnosis, materia medica, hygiene, and general therapeutics. Ibn Rushd recognized that no one catches smallpox twice. He also explained the function of the retina. Ibn Rushd's Kulliyat was translated into Latin by Bonacossa. With Ibn Zuhr's Taisir, it was according to Sarton `the most valuable of their kind in medieval times.'
Abd al-Wahid Al-Marrakushi was born in Marrakech in 1185; studied there, also in Fez, and after 1208 in Spain, but left it in 1217. In 1224, he completed a history of the Almohad dynasty, preceded by a summary of Spanish history from the Muslim conquest to 1087 (Kitab al-mujib fi talkhis akhbar ahl al-Maghrib). The text has been edited by Dozy. There is a French translation by Fagnan. Extracts can be found in Wustenfeld and Levi Provencal. Hassan-al-Marrakushi’s main work is Jami al-Mabadi wal-ghayat (the Unity of the beginnings and ends; i.e: principles and results), probably completed in 1229-1230. This is a very good compilation of practical knowledge on astronomical instruments and methods, trigonometry and gnomonics. Part of this work has been translated by Sedillot. The Jami of Hassan al-Marrakushi was, Sarton holds, the most elaborate trigonometrical treatise of the Western caliphate, the best medieval treatise on practical astronomy, on gnomonics, the best explanation of graphical methods. The part dealing with gnomonics contained studies of dials traced on horizontal, cylindrical, conical, and other surface for every latitude. Al-Marrakushi gave a table of sines for each half degree, also tables of versed sines and arc sines (this last one he called the table of al-Khwarizmi). To facilitate the use of gnomons he added a table of arc cotangents. The second part of al_jami was devoted to the explanation of graphical methods of solving astronomical problems. Al-Marrakushi's work develops the construction of planispheres, astrolabes, quadrants and the needs of gnomonics, which was the great interest of Sedillot who has written by far the best account on Muslim astronomical instruments.
Al-Marrakushi shows his familiarity with the mathematical and astronomical works of al-Khwarizmi, al-Farghani, al-Battani, Abu'l Wafa, al-Biruni, Ibn Sina, al-Zarqali, and Jabir Ibn Aflah. For example, he shared al-Zarqali's belief that the obliquity of the ecliptic oscillates between 23 degrees and 33' and 23 degrees 53', a belief which tallied with the notion of the trepidation of the equinoxes.
It is interesting here to note that Al-Marrakushi, on the evidence provided in his manuscripts, has devoted much study to trigonometry and associated subjects, and then to read in works on the history of science, including by Crombie one of the most renowned figures of such history, who says the following:
`The development of modern trigonometry dates from mathematical work done in Oxford and France in the fourteenth century in connection with astronomy.'
Had Crombie, just briefly consulted al-Marrakushi, he would have realised how far from the truth he was.
-M. Brett: Marrakech in Dictionary of the Middle Ages; Charles Coulston Gillispie Editor in Chief; Charles Scribner's Sons; New York; 1980 onwards; vol 8; pp 150-1.
-R. Brunschvig: Un aspect de la literature history-geographique de l'Islam; Melanges Gaudefroy Demombynes.
-A.C. Crombie edition: Scientific Change, Heinemann, London, 1963.
-G. Deverdun: Marrakech; Editions Techniques Nord Africaines; Rabat; 1959.
-R.P. A. Dozy: The history of the Almohads; Leiden 1847; again, 1881.
-R. Landau: Morocco: Elek Books Ltd, London 1967.
-A.L. Mayer: Islamic astrolabists, Albert Kundig edition, Geneva, 1956.
-Abdel Wahid al-Marrakushi, The History of the al-Mohades, edited by R.Dozy; Leiden; 1881.
-E.L. Provencal: Al-Maghrib; in Encyclopaedia of Islam; New edition; Vol. 5; 1986; Leyden; pp. 1208-9.
-G. Sarton: Introduction to the History of Science; 3 vols.; The Carnegie Institute of Washington; 1927-48.
-L. Sedillot: Memoire sur les instruments astronomique des Arabes, Memoires de l'Academie Royale des Inscriptions et Belles Lettres de l'Institut de France 1: 1-229; Reprinted Frankfurt, 1985.
 E.L. Provencal: Al-Maghrib; in Encyclopaedia of Islam; New edition; Vol. 5; 1986; Leyden; pp. 1208-9.
 M. Brett: Marrakech in Dictionary of the Middle Ages; Charles Coulston Gillispied Editor in Chief; Charles Scribner's Sons; New York; 1980 onwards; vol. 8; pp. 150-1.
R. Landau: Morocco: Elek Books Ltd, London 1967. p.80
 G. Deverdun: Marrakech; Editions Techniques Nord Africaines; Rabat; 1959. pp. 264-5.
 G. Deverdun: Marrakech; 1959.pp. 264-5.
 G. Deverdun: Marrakech; .p. 262.
 A.L. Mayer: Islamic astrolabists, Albert Kundig edition, Geneva, 1956.
 G. Deverdun: Marrakech; op cit.; .p. 263.
 R. Brunschvig: Un aspect de la literature history-geographique de l'Islam; Melanges Gaudefroy Demombynes.
 G. Deverdun: Marrakech; op cit.; p. 263.
 Abdel Wahid al-Marrakushi, The History of the al-Mohades, edited by R. Dozy; Leiden; 1881; p.209.
 G. Sarton: Introduction to the History of Science; 3 vols; The Carnegie Institute of Washington; 1927-48. Vol. 2; p. 69.
 G. Sarton: Introduction; vol. 2; p.681.
 R.P. A. Dozy: The history of the Almohads; Leiden 1847; again, 1881.
 French translation by Edmond Fagnan (Revue Africaine, Vols. 36 and 37, passim; separate edition, 332 p., Alger 1893).
 Critiscism: F. Wustenfeld: Geschichtschreiber der Araber (109, 1881). C. Brockelmann: Arabische Litterartur (vol.1, 332, 1898). E. Levi Provencal: Documents in edits d'Histoire almohade (440p., Paris, 1928, p; Isis, 13, 221).
 G.Sarton: Introduction; op cit.; vol. 2; p.621.
 E.L. Provencal: Al-Maghrib; in Encyclopaedia of Islam; pp. 1208-9.
 G Sarton: Introduction; op cit.; p. 508.
 G. Sarton: Introduction; op cit.; vol. 2; p.621.