The idea that Romanticism was basically a reaction against the rationalism of the scientific revolution and the enlightenment is an oversimplification. It's a useful starting point, but, as always, reality is always far more rich and interesting than historical or theoretical generalisations.
Poetry was a different thing in thar era, and so was science. This is what Wordsworth said about poetry: 'Poetry is the breath and finer spirit of all knowledge…Poetry is the first and last of all knowledge – it is as immortal as the heart of man.’ (From Preface to Lyrical Ballads (1801)). And Shelley: 'It is impossible to read the compositions of the most celebrated
writers of the present day without being startled with the electric life which burns within
their words. They measure the circumference and sound the depths of human nature with
a comprehensive and all-penetrating spirit, and they are themselves perhaps the most
sincerely astonished at its manifestations; for it is less their spirit than the spirit of the
age. Poets are the hierophants of an unapprehended inspiration; the mirrors of the
gigantic shadows which futurity casts upon the present; the words which express what
they understand not; the trumpets which sing to battle, and feel not what they inspire; the
influence which is moved not, but moves. Poets are the unacknowledged legislators of
the world.' (From A Defence of Poetry (1821))
In 19th century Europe, poetry was important in a way that it isn't any more. From our perspective, it may seem like the Romantic movement was a reaction against reason and science, but the problem with that view is that it is informed by a conception of poetry which is inaccurate. In that world, poetry was regarded as a legitimate way of expressing objective truth. It was a respected discourse. And science as we know it was still developing. Completely different categories, narratives, ways of explaining and understanding the world, applied.
Also, if we go back to the 18th century and before, we find that science was a lot more language based. We've come to believe implicitly in mathematics and to accept its principles as being beyond question, but that wasn't always the case. Scientists used to be called philosophers and 'science' was more about constructing a sound argument. Everything was proved linguistically, not mathematically.
Language used to have a quality of inviolability about it. In the Bible, Jacob gets his father's blessing by trickery. Esau was the first born so he should have recieved the blessing. Isaac thought he was blessing Esau, but it was actually Jacob, and because he was blind, he couldn't tell. When Esau turned up later on, both he and his father were devestated because Jacob had usurped his brother's birth right. This is what I mean about inviolability....the way we think is that, because Jacob recieved the blessing by trickery, it's invalid...we think along the lines that, it's only words....Isaac should just say that it doesn't count and actually give the blessing to Esau. But Isaac didn't see that as an option. The words had been spoken and that's it.
I don't think people in previous eras thought in this way because they were more honourable than us, necessarily. I think society needed to place more importance on the spoken word because they didn't have as much access to the written word. So, every statement was given the authority of a formal pronouncement. There was an understanding that it needed to be like that, otherwise there would be chaos.
So, it's not exactly true to say that Romanticism and the work of the Romantic poets was a reaction against reason and the enlightenment and the scientific revolution, because, firstly, those works didn't hold the place that we would assign to poetry, and secondly, science was also not what we think of as science.
There are ways in which it was that kind of reaction, but it's complicated. Shelley was interested in science. One of the leading scientists in England - Humphry Davy - was friends with Wordsworth and Coleridge and their circle. Out of the 6 major English Romantic poets, probably Blake is the only one who can accurately be described as anti-science in some ways. He didn't like Bacon's, Newton's and Locke's approach to understanding and analysing the world. But even with Blake, it was not about a rejection of rationality in favour of a more sensual or emotionally fulfilling vision. Blake's struggle with Bacon, Newton and Locke was an intellectual meeting and engagement. He rejected their ideas because he understood them, or at least had his own understanding of them. Blake invented his own system for understanding the world and that system did not agree with the world-view of Bacon, Newton and Locke.
If we look beyond England, it's even clearer that Romanticism wasn't fundamentally opposed to science, because some of the writers were scientists in their own right. So, Goethe, for example, is one of the greatest writers and he also practiced science. He's an interesting example of how Romantic writers were not opposed to science or reason in themselves - not at all - but their literary sensibilities led them to take issue with the approach of some of the leading scientists and philosophers. Goethe disagreed with Newton's ideas about light, but he didn't stop with critiquing Newton, he proposed his own theory and published a book about it. It's interesting to reflect on the nature of that disagreement and the kind of scientific practice Goethe's approach led him to, because it's very ironic.
It kind of comes down to what I mentioned earlier about not trusting mathematics. Goethe didn't trust calculation as a way of arriving at the truth. To Goethe, it seemed like Newton made very limited observations, then, based on those observations, formulated rules, and then used the mechanisms of calculation (in an underhanded way) to make further observation fit with his rules. Goethe thought the work of a scientist was to observe the whole range of possible phenomena and to catalogue them and analyse them and, through that process, to formulate rules. Most of the work was observation, collection and cataloging of specimens, and only after that phase was complete did you begin your analysis and the formulation of theory. Observation was central to the scientific enterprise. You could start formulating theory before you had completed all your observations, but it was necessary to keep making observations because that was how you tested your theory.
OK, so it fits with the Romantic ethos in the sense that it was all about going out into the world - into nature - and collecting specimens....going on adventures. Another famous scientist of this style was Joseph Banks, who travelled the world collecting specimens and documenting flora and fauna. The irony is that the poets and Romantics ended up just doing a lot of cataloguing and recording - not that exciting, and kind of pedestrian - while Newton, who did a lot of work at home or at school or indoors - a lot of mental work - ended up formulating some of the most ground-breaking and exciting insights ever. So, he is more of a Romantic figure, actually.
Newton won of course. His theories are now more than theories. They are laws. But, with a lot of the scientific advances made in the 20th and 21st century, it's almost as if literature got its revenge, because nothing is as it seems. As you approach the speed of light, time slows down and mass increases. Time passes more quickly at hgher altitudes because gravity warps space and time. And there's Heisenberg's uncertainty principle which I'm not really sure how to explain, but the basic idea is that, for things with a very high wavelength - like an electron - we literally can't know both its position and its momentum. As a consequence, the result of the experiment changes depending on what type of observations we try to make. And then there are entangled particles.....two photons that are separated - can even be by hundreds of miles - but they are somehow connected so that, if a change is made to one, the other one is also affected.
Something exciting that's happening now is the advent of quantum computing, which uses these principles of quantum physics to do a new kind of computing. The uncertainty principle actually has a practical application. With traditional computing, every bit is either a one or a zero, but quantum computers have Qbits which have a third option. A Qbit can be one, zero or both. And quantum computing is open to everyone. Through an open source project called Qiskit, IBM provides access so that anyone who wants to can write and run quantum programs.