Hi i recently was in a thread in r/memes and some commenters there pointed out the relationship between scientist and the church especially about galileo and archimedes
Was it true that the church ripped the archimedes codex in half and scraped the pages and had hymns written on top of it and poorly preserve it?
Did galileo got "cancelled" for denying and contradicting church doctrine?
Did the church believe the Earth was flat?
So there is a lot of unpack here, but the short version is that the story underlying your questions is a naive version of the so called "Conflict Thesis" on the relationship of religion and science. This was very popular in the mid- to late nineteenth century, especially as promoted by two highly prominent American academics: Andrew Dickson White and John William Draper. This thesis, at least in this form, is wrong and no relevant historian of premodern science supports it. But it remains popular because the original function of this story was not to understand the history of science or religion, but to elevate the role and prestige of science in the present day; and this is very much how it continues to be used in the popular sphere today.
On the conflict thesis and it's role in education see these two comments by /u/restricteddata: 1, 2.
The dominant view among modern historians, if we had to give it a name, would be a complexity thesis. Religion, science and human societies in general are highly complex social and historical phenomena, and they simply aren't adequately understood through these sorts of simplistic narratives. But that is understandably a lot less pithy. So lets look at your examples to see how this plays out:
Was it true that the church ripped the archimedes codex in half and scraped the pages and had hymns written on top of it and poorly preserve it?
Ya, that was totally a thing that happened. But this becomes a lot lets shocking when we start filling in the details. So first and foremost, it is important to understand that this process of recycling books, leaving what is called a palimpsest, was extremely common. Manuscripts in the middle ages were made of animal skin, and the process of it's production, especially for high quality parchment (I use this term colloquially here), was extremely expensive and labour intensive. So especially in places like less well off monasteries, it was a very natural decision to recycle little used books when new ones were needed, rather than trying to cobble together the resources to obtain new writing material. And this happened all the time with all sorts of texts, both religious and secular. (There is a comment by /u/xenophontheathenian explaining this in more detail here, although the comments by /u/QVCatullus upthread and throughout are also highly relevant.)
But more importantly, lets consider the history of the manuscript itself. Contrary to what I imagine many people reading this story might imagine, the original Archimedes manuscript does not come from the ancient world, much less the period of Archimedes himself. The original manuscript was produced in Constantinople around the 10th century, it is suggested that it may been related to lineage of Leo the Mathematician's school. Befitting a production in such a high status context, it was produced on very large and we probably can safely suppose fairly high quality parchment. So right from the outset this should cast some significant doubt in our minds about any supposed opposition to Archimedes by the Church itself, since where else would the institutional greek church have had more influence than in the imperial court itself!
But the book didn't remain in Constantinople. Likely as a result of the sack of city by the members of the Fourth Crusade, and the establishment of the Latin Dynasty in 1204, this manuscript found its way to the Monastery of Saint Sabbas near Jerusalem. It is here, some twenty years later, that the manuscript was recycled, with the pages being unbound, scraped down, and reformed into a prayerbook with a width of half the hight of the original manuscript. This book remained in use at the Monastery for the next 600 years.
So what are we to make of this repurposing? Unlike the academics at the court of Constantinople, monks of the monastery plausibly had little use for or interest in a work of abstract mathematics. They do, on the other hand, have a lot of use for good quality parchment! There is perhaps a sense in which religion had some marginal role here, no doubt if these were the monks of Walter Miller, they might have been more interested in making ornate copies of such a text. But in the final analysis, this story seems considerably more comparable to a library disposing of little-used books that it can no longer pay to maintain, than to anything like a sort of state sponsored book burning.
And it is precisely this sort of decontextualisation of historical details and recontextualisation within a largely fictive account of the Church's antipathy to science that is characteristic of this sort of naive conflict thesis.
Did the church believe the Earth was flat?
This is even more straightforward: No. This has never been an officially supported position by any significantly sized Church. Indeed, with few exceptions, notably among some Syriac Christians in the patristic period or perhaps among a small subset of fundamentalists since the nineteenth century, this has never been a significant position among christian authors. Indeed, those Christians who support or more likely flirt with such an idea are not even unique for this position in the Roman period, since of course the Epicureans likewise denied the sphericality of the earth. But in any case, this passed entirely out of relevance by the 6th century and the last author who even arguably has some confusion on this point is Isidore of Seville. (Although, there is considerable disagreement about how to interpret his sparse comments on the subject.)
But I've written about this repeatedly in the past, here is a small selection as it relates to pre-Newtonian theories of gravity: 1, to popular knowledge of the earth's shape: 2, to knowledge of the alternation of seasons in different regions of the world: 3, and to the myth itself: 4.
Did galileo got "cancelled" for denying and contradicting church doctrine?
This is probably the most complicated case here, and I won't write much about it as I have already in the past, particularly as it relates to what came before in the Middle Ages, here. There is also an excellent roundup of much more detailed answers on the Galileo affair itself by DanKensington here.