The Mathematics of Magic

"The Mathematics of Magic" is a fantasy novella by American writers L. Sprague de Camp and Fletcher Pratt, the second story in their Harold Shea series. It was first published in the August 1940 issue of the fantasy pulp magazine Unknown. It first appeared in book form, together with the preceding novella, "The Roaring Trumpet", in the collection The Incomplete Enchanter, issued in hardcover by Henry Holt and Company in 1941, and in paperback by Pyramid Books in 1960. It has since been reprinted in various collections by numerous other publishers, including The Compleat Enchanter (1975), The Incompleat Enchanter (1979), The Complete Compleat Enchanter (1989), and The Mathematics of Magic: The Enchanter Stories of L. Sprague de Camp and Fletcher Pratt (2007). It has been translated into Dutch and Italian. In 2016, the story was shortlisted for the Retro Hugo Award for Best Novella.

The Harold Shea stories are parallel world tales in which universes where magic works coexist with our own, and in which those based on the mythologies, legends, and literary fantasies of our world and can be reached by aligning one's mind to them by a system of symbolic logic. In "The Mathematics of Magic", Shea visits his second such world, that of Edmund Spenser's epic poem The Faerie Queene.

Plot summary
Psychologist Harold Shea's accidental visit to the world of Norse mythology has confirmed his colleague Reed Chalmer's speculation that alternate universes can be reached by employing a system of symbolic logic encoding their basic assumptions. Encouraged at his theory's validation but pessimistic as to the prospects of it being taken seriously by their profession, Chalmers proposes to join Shea in a second expedition, more carefully planned, to a world in which they can achieve the fame and fortune that they are unlikely to gain in their own. He suggests the world represented by Spenser's The Faerie Queene.

Outfitting themselves appropriately, they make the attempt and are successful in reaching their target world. They soon encounter the Lady Britomart, one of Queen Gloriana's knights, in whose company they attend a tournament at the castle of Satyrane. At the feast afterward Chalmers becomes smitten by a magical simulacrum of the Lady Florimel, only to lose her in the confusion engendered by a sorcerous disruption of the proceedings. Later he and Shea undertake to find the root of the trouble, a secret brotherhood of enchanters they theorize has been tipping the balance against the forces of good, and which they hope to infiltrate and subvert. They meet the woodland huntress Belphebe, with whom Shea becomes enamored, and face the peril of the Blatant Beast, summoned up by Chalmers in a spell gone wrong.

Finally, the two succeed in infiltrating the enchanters' cabal, Chalmers as a magician and Shea as his apprentice. Chalmers, bringing a systematic and scientific approach to bear on the study of magic, fits right in—a bit too well, in Shea's opinion. The secret society appears so congenial to Chalmers that Shea becomes concerned the subversion is going the other way. Escaping, he reveals the enchanters' lair to the realm's knights, who gather to assault it, aided from within by the magic of Chalmers, who was not as far gone as Shea had feared. In the aftermath, Shea and Belphebe are blasted back to the mundane world by the attack of a surviving magician, whereupon Belphebe finally accepts Shea's proposal of marriage.

Relation to The Faerie Queene
The plotline of the story departs from its source, Spenser's unfinished poem, as it is the avowed intention of the protagonists to resolve the situation therein. The perceived greater difficulties faced by Spenser's knights in the later portions of the poem are explained by the evil enchanters of the piece having secretly organized into a guild to more effectively oppose them. Shea and Chalmers are instrumental in revealing this conspiracy to the knights and assisting in its overthrow.