In writing a novel about a mathematician and his computer scientist son, I've begun thinking about literature in terms of equations.
For instance, I thought about the famous phrase by John Keats: "Beauty is truth, truth beauty." I decided that his equation is imbalanced. Truth is rare. Beauty's cheap. Any jerk can flatter people. What do you think?
Separately, as part of my novel, I rendered the first scene of King Lear as instructions in an Apple BASIC program, the first programming language I learned and still one of my favorites.
20 PRINT "OUR DARKER PURPOSE"
60 IF KING(CORDELIA) < KING(GONERIL) THEN 70
70 IF KING(CORDELIA) < KING(REGAN) THEN 80
80 KINGDOOM = LAND/2
The above lines mix BASIC's structure with function call syntax from the C programming language, but they get the point across. I didn't include every line I wrote to summarize Lear I,i in the novel. But I liked the typo KINGDOOM, and thought that line (80) condensed the play decently in one command.