Catherine Gehrig is a middle-aged horologist working in "the Georgian halls" of the Swinburne Museum, London SW1. For the last 13 years she has been in love with her married colleague, Matthew Tindall, and when he dies suddenly (on 21 April 2010 – the book is full of precisions) she is distraught. Out of charity and to avoid scandal, her boss Eric Croft moves her to the museum annexe in Olympia and gives her a recent acquisition to assemble: a complex mechanical toy that she first thinks might be a monkey, then decides is a duck. (Actually, it's a swan: the transformation of ugliness into beauty is one of many presiding themes.) Croft's hope is that Catherine will be led towards recovery by "the huge peace of mechanical things". In fact she is first irritated, then distracted and eventually bewitched by a story that has some peculiar parallels with her own, and some corrective deviations from it. This story, which is told in sections that alternate with Catherine's own, involves Henry Brandling, scion of a wealthy 19th-century railway family, husband of sourpuss Hermione and father of sickly Percy. When Percy falls ill, and all the usual Victorian therapies have failed, Henry becomes convinced that a foreign and mechanical entertainment might heal him. "When my little fellow saw the design of M Vaucanson's ingenious duck," he says, "a great shout – huzza – went up from him. It was a tonic to see the colour in his cheeks, the life brimming in his eyes where I observed the… 'magnetic agitation' which is a highly elevated form of curiosity or desire." In order to turn these designs into the real thing, Henry travels to the Black Forest south of Karlsruhe, where watch-makers have a reputation for exceptional brilliance (it's the original home of the cuckoo-clock). Here he encounters assorted servants, manufacturers, schemers and dealers, before landing in Furtwangen with Frau Helga, M Artaud the silversmith and collector of fairy stories, the mechanical genius Herr Sumper, and "his golden shadow", the equally ingenious but injured boy, Carl. While the cogs and pistons of this little society threaten to destroy Henry, rather than help him discover a means of curing his child, Catherine begins to assemble his story and the toy it centres around. It is now that parallels between the two narratives begin to emerge. Sumper, it transpires, is "a most eccentric bully" who is determined to create for Henry "something far superior" to his original desire. Croft, though less obviously manipulative, arranges for Catherine to be helped in her labours by the glamorous young Courtauld girl Amanda Snyde (Carey has always liked tell-tale Dickensian names), who is in fact a sort of spy. Her boyfriend is dead lover Matthew's elder son, and her grandfather is a friend of Croft's – and so able to pass back secrets that emerge during the reassembly of the swan. Carey manages these time-shifts and other complications with the same easy-seeming mastery that he shows in all his novels. But here the fluency seems especially apt, because it is always devoted to the service of machines that themselves depend on being cunningly assembled and delightful. In other words, there is an immaculate fit of means with themes – although (and because) these themes turn out not simply to concern the beauty of science, but the ways in which science and humans interact and overlap. We begin to see this all the more clearly as the story rises towards its climax, in which Sumper reveals to Henry that during his previous work-life he has been involved with a certain Sir Albert Cruickshank, a brilliant and underfunded London scientist-cum-engineer (who sounds more than a little like Charles Babbage). Carey is too subtle a writer to spell out precise meanings through this passage of bravura writing, but his intentions are clear enough. While designing the wooden patterns from which Cruickshank's greatest invention will be cast (his Mysterium Tremendum), Sumper gains an understanding of high science that is truly visionary. Specifically, it is a vision of how to discover order in a random universe – something that runs the risk of seeming crackpot, or being proved unworkable, and yet preserves a kind of nobility. "It soon became clear to me," Henry says, "that what [Sumper] so excitably described as 'deep order' was a True Believer's attempt to give meaning to a mess – children's toys, oriental figurines, turned brass implements, fragments of marble and a huge library of books in front of almost every one of which was placed some curiosity or object, each of which beckoned one's attention." This is the lesson Catherine has to learn more than a century later. Henry pursues a beautiful invention to heal his boy; she reassembles the swan as a means of balancing her grief. In both activities, bounds are set around parts of humanity that are not mechanistic (call them "souls" – a word that appears on the final page of the novel). Yet it turns out that the most tremendous of all Mysterium Tremendums is the body, which operates according to specific laws ("the chemistry of tears"), and which suffers no loss of beauty, or wisdom – or even marvellousness – in the process. Carey has tackled some of these ideas before (the most obvious precursor to the construction of machines in this book is the transportation of the church in Oscar and Lucinda). But here everything has been designed, tooled, oiled and fitted together with greater economy and an equal panache. Does this mean the book ends too neatly? No. Even as it settles its main concerns, it floats new ideas (was golden boy Carl the young Karl Benz?), and emphasises latent themes (the greater love between parents and children; the endless human capacity for misunderstanding). Furthermore, its idea of order remains compellingly unstable. It is one thing to devise, like Cruickshank, a machine that accurately maps the sea-bed, so that ships don't run aground and people don't drown. It is another to devise a plan that encompasses all the moods and vagaries of humanity. In their different ways, both Henry and Catherine prove this. They know the rage for order is at once completely sensible and somewhat lunatic. Their broken hearts tell them this.