"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.
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.
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.
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.