sum((0:10).^2)\11 :

a Zero-based Least Squares Solution in 11 Fits (annotated)

(©Tim Davis, 2013)


Notes:  Puzzled at the math?  Below is an annotated version of the poem. Click on the underlined links for more information.

A romantic-mathematical poem, wherein the kth Fit consists of k vectors, each of length k.  In each Fit, vectors 1:k-1 rhyme with k, and the final kth vector is terminated in k. Fits 0:4 require additional support vectors.  Written in 2013 (do the math...).

  1. Notes:  Poetry can be romantic, we all know that.  This poem shows that it can be simultaneously mathematical.  Who knew?

  2. Fit” is an archaic literary term, denoting a stanza of a poem or song.  Lewis Carroll reintroduced the term in “Hunting of the Snark: An Agony in 8 Fits.”  However, we also use the term “fit” in mathematics, for lining up (fitting) a mathematical model to measured data.  It’s also fitting (pun intended) that Lewis Carroll was also a mathematician who worked on matrix algebra, among other things.

  3. Each stanza (fit) in this poem consists of k lines, each with k syllables.  A line in mathematics can also be called a vector, and a matrix is a set of vectors.  Each line (vector) in the kth stanza rhymes with the number k, except for the last line (vector) which ends in k itself.  So Fit the 3rd is 3 lines of 3 syllables, each of which rhyme with 3, and the last stanza ends with 3 itself.

  4. 1:k is MATLAB notation for the sequence [1, 2, ..., k].  The title, sum((0:10).^2)\11, takes the numbers [0 1 2 3 4 5 6 7 8 9 10] and squares each of them (the .^2), and sums them up to get 0 + 1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 = 385, which is the total number of syllables in the poem.  Backslash ( \ ) solves a matrix equation, and it uses a least-squares fit if the matrix is rectangular.  Each of these fits are square, however.  I do a lot with slash and backslash in MATLAB, and x=A\b uses my sparse LU, Cholesky, and QR factorization methods when A is sparse.

  5. A support vector is used in a Support Vector Machine used in machine learning.  Here, I use it to mean a line of poetry that supports (helps define) a preceding line.

  6. “Do the math” because the poem refers to our wedding in May of 1987, and 26 years of marriage (thus it was written in 2013).

Fit the 0th.

    [ ]

        (Which raises the question, an answer I sought.

         Is zero a something, a nothing, or naught?)

  1. Notes:  How can you write a stanza of zero lines each of zero syllables?  Oh, I just did.  The result is an empty matrix, or [ ] in MATLAB notation.

  2. Zero was a puzzling number to ancient cultures.  They weren’t even sure if it was really a number or not.  In my research into sparse matrix algorithms, I deal with zero all the time (a matrix is sparse if it has lots of zeros).  You could say that zero is my favorite number.  And you would be right, because it is.

  3. There are actually two kinds of zeros in a sparse matrix.  Think of a matrix as a large spreadsheet, and imagine that it’s mostly blank.  It would save a lot of space if we just store the entries that are there, and leave out the blank entries.  One zero is a zero that’s always a zero (a blank), and it doesn’t find its way into the data structure used to represent the matrix.  But what if an entry is present, and happens to be zero?  So you have two kinds of zero: blank (which is zero and which you don’t represent) and zero (which you keep track of even though it happens to have a value of zero).  You might have computed 3 minus 3 to get a number that you keep track of (zero), or you might never need to compute a number (like the blank in the spreadsheet).

  4. So in a sparse matrix, “what is this zero?  Is it present or not?” is a very important question, since there are two kinds of zero:  a zero that is something, and a zero that is not.  But both kinds of zero are naught.

Fit the 1st.

    [ 1 ]

        (To live alone is singular,

         Before a wife is won.

         But matrix [1] has signature

         Of (1, and nil, ... and none?).)

  1. Notes:  Following my stated rule, Fit the 1st consists of a single line of one syllable, which ends in 1.  So it’s just 1 itself.  There’s only a single stanza that fits this rule, for Fit the 1st.  You could say that this stanza is singular, in the common English sense of the word.

  2. However, we say that a square matrix is singular if one or more of its rows or columns are multiples of some other rows / columns.  Singular matrices can be hard to deal with if they represent a linear system.  Say x+2y=3 and x+2y=4 are two equations that must both be true.  What are x and y?  The 2-by-2 matrix for this equation would be:

  3.      1   2

  4.      1   2

  5. and the system has no solution.  The 2-by-2 matrix is singular.  A linear system with a singular coefficient matrix has either no solutions, or an infinite number of solutions, but never a single unique solution.

  6. A matrix can be 1-by-1, and the only singular matrix of that size is [ 0 ].  So the matrix [ 1 ] is nonsingular (the system of equations x = 3 clearly has a unique solution).

  7. In non-mathematical language, it sounds a bit odd for a mathematician to say that [ 1 ] is nonsingular, since the number one is grammatically singular.

  8. A singular matrix has at least one zero eigenvalue.  (If you’ve ever done a search in Google, you’ve used an eigenvector).  The signature of a matrix consist of three numbers (a,b,c), where a is the number of positive eigenvalues, b is the number of negative eigenvalues, and c is the number of zero eigenvalues.

  9. So a nonsingular matrix has a signature of (a,b,0), and the matrix [ 1 ] has signature (1,0,0).

  10. This stanza puzzles over the disconnect between matrix singularity (the matrix [ 1 ] is nonsingular), yet the number 1 is grammatically singular.

Fit the 2nd.

    With you,

    we're 2.

        (For Connie my wife and my optimal dual;

         Of that I'm most certain, by logic of Boole.)

  1. In mathematical optimization, we look for the best answer among many possible answers.  A simple example is finding the maximum or minimum value that a function can take (find x that makes f(x) the largest or smallest).  An optimization problem can be viewed in two ways: the original problem and its dual.

  2. But of course, in the sense of my personal relationships, Connie is my (only) and optimal dual.

  3. Boole (1815-1864) was a mathematician who connected logic and algebra together.  Boolean algebra forms the basis of how computers work, so you’re relying on Boolean algebra right now, to read this web page on your computer.

Fit the 3rd.

    You and me:


    Now we're 3.

        (For Emily, my lovely lass,

         And most delightful daughter,

         Who can be silly (just for laughs),

         But not quite like her father).

  1. Notes:  The math is easy for this one:  Connie + Me = Emily, our first born and only daughter.

Fit the 4th.

    Who's keeping score?

    Don't ask "what for?"!

    We'll add one more --

    Timothy's 4.

        (For Timothy, our 2nd born,

         and 1st and only son.

         Who perseveres, for 1 to n,

         until the deed is done.)

  1. Notes:  Timothy is the 4th member of our family.

  2. In computer programming, a “for loop” specifies that a set of instructions be repeated for a specific number of iterations.  It’s common to call the first iteration “1” and the last one “n”.  Thus “for 1 to n” does the whole task, and likewise, when Timothy sinks his teeth into something, he perseveres until the task is completed.  I do the same.

Fit the 5th.

    Our kids like to strive

    With digits alive

    When numbers arrive --

    There's math to derive!


  1. Notes:  Did you see it?  That was an easy one.  Derive this in 5 digits (meaning both fingers and numbers):

  2. 22345.

  3. Two to Three, for Five

  4. 2 + 3 = 5.

Fit the 6th.

    Do the math when it clicks:

    I'm the number she picks.

    And the rest of the chicks?

    To them all, I say "nix!",

    For a marriage that sticks

    In our year 26.

  1. Notes:  Connie and I have been married

  2. 26 years, as of 2013 when I wrote this poem.


Fit the 7th.

    It took a year of savin'

    To buy a ring engraven

    With promises I've proven --

    A theorem I'm believin'!

    So witness, earth and heaven:

    To me, her hand was given,

    In May of '87.

  1. Notes:  OK, I’m stretching things a bit.  Connie’s ring isn’t engraved, but she did engrave our wedding date on my ring (Connie Tim 5-23-87).  So I can never forget our anniversary!  However, my ring given to her represents my proven promise, so it’s symbolically engraved in my promise, represented by the ring, if not on the physical ring itself.

Fit the 8th.

    Grabbing a byte and negating,

        to printf a seven in oct ...

    Writing in C can be grating;

        my software has bugs! (and it's late).

    Connie thought, "He left me waiting;

        our date was for seven o'clock!"

    Bugs take a back seat to dating,

        and so we had dinner at 8.

  1. Notes:  In a computer, a byte is a number of 8 binary digits (bits).  The binary represention of 8 is 1000.  In 1’s complement negation, this becomes 0111, which is the number 7.  printf is a function in the C programming language for printing a string, and oct is a common shorthand for octal, the base-8 number system.  printf can print numbers in decimal (base-10) but also in octal (base-8).

  2. Connie knows what it’s like when I tracking down a bug in my code!  I can be so single-minded that I look up from the keyboard and to my surprise find my lunch, uneaten, at 4pm in the afternoon.

  3. Negating / grating / waiting / dating don’t quite rhyme with 8, but they do if you match a feminine rhyme with a masculine one.  That seems fitting for a romantic / mathematical poem.

Fit the 9th.

    If a poet should toss in a line

    To a pirate who's saved from the brine,

    Fully drenched, will his map stay affine?

    Oh, it warps! -- like a cosine or sine,

    And the X, still unknown and malign,

    Hides his pieces of eight, by design.

    But no pirate can't take what is mine,

    For I'll circle thee, wife, and what's thine,

    In twice 3.14159.

  1. Notes:  This stanza plays with the word “line,” which appears in three different meanings: (1) a line in a poem, (2) a rope thrown to the pirate, and (3) a mathematical line.  It also plays with two meanings of “map.”  In mathematics, a map connects one space to another, and in an affine map, lines that are straight in one space remain straight in the next.  Of course, the pirate’s map warps when it gets wet, so it’s not an affine map.  The sine and cosine functions aren’t straight, and look like the ocean waves from which the pirate was rescued.

  2. X is commonly used to represent an unknown quantity, and in pirate lore, X on the map hides the treasure (usually buried under the skeleton of some luckless pirate, and thus X is malign).

  3. The circumference of a circle with radius 1 is 2pi, where pi = 3.14159...

Fit the 10th.

    Shall I compare thee in true precision?

    Or round, to nearest approximation?

    Thou art more lovely than a summer glen,

    Where paths traverse the leaves and nodes, and then,

    Amidst the 'edges cycle back again.

    Where we can hear the song of lark and wren

    Transformed by FFT's beyond our ken.

    And where can none divide our love, and when,

    Our union's sealed, by diagrams of Venn.

    How do I love thee?  I count thee my 10.

  1. Notes:  Each line of a sonnet has 10 syllables, as does this stanza.  The stanza is a take-off on one of Shakespeare’s sonnets (“Shall I compare thee to a summer's day?  Thou art more lovely and more temperate ...”) and one by Elizabeth Browning (“How do I love thee? Let me count the ways.”).  The rest is mine.

  2. In mathematics, a graph consists of a set of nodes connected by edges.  Think of facebook, where each person is a node (draw a point or circle) and where each friendship between two people is an edge (draw a line) connecting them.  A path in a graph goes from node to node, following the edges.  In a cycle, the path returns back to its starting node.  Below is a graph of 4 nodes and 4 edges.


  4. A tree is a graph with no cycles, and in a rooted tree, one node is designated as the root.  Nodes with a single edge are called leaves (excluding the root).  The graph above is not a tree, since it has a cycle of nodes 2, 3, and 4.

  5. FFT is short for a “fast Fourier transform” which is an algorithm that converts a signal (such as a sound wave) into its constituent frequencies.  If you’ve ever listened to an audio track in MP3, you’ve been listening to a discrete cosine transform (DCT), which is related to the FFT.

  6. Can you see the song of lark and wren, transformed by FFTs beyond our ken?  I can, via mathematical algorithms that translate music into art.  Below is my algorithmic rendering of TVSong by Blue Man Group.  Click on the image for more examples.

  7. In set theory, a Venn diagram draws sets as circles, and a set union is drawn as two circles that partially overlap.

  8. And of course, Connie is my perfect 10.  And yes, she loves this poem written for her by her geeky romantic / mathematical / poetical husband.

Click here to go back to the non-annotated poem.