POEMS AND RHYME SCHEMES ABAB I've never seen a purple cow I hope I never see one But this I'll tell you anyhow I'd rather see than be one. CBCB There was a young lady from Bright Whose speed was much faster than light. She set out one day In a relative way And returned on the previous night. AABBA Roses are red Violets are blue Sugar is And so are you. ABCB AA Fleas Adam Had 'em Here Lies my wife Here let her lie Now she's at rest And so am I. ABCB There once was a fellow from Drew Whose limericks stopped at line two. There once was a man from Verdun. Sonnets: ABBAABBACDCDCD ABABCDCDEFEFGG One-line poem: A : 1 way to do it Two-line poem: AA, AB : 2 ways to do it Three-line poem: ABC ABB AAB AAA ABA Four-line poem: AAAA AAAB AABA AABB AABC ABAA ABAB ABAC ABBA ABBB ABBC ABCA ABCB ABCC ABCD Is there way to compute the number of ways to rhyme an n-line poem IF we already know the number of ways to rhyme a poem with fewer than n lines? Let f(l,r) be the number of ways to have r DISTINCT rhymes in a poem with l rhymes. ABCB has three distinct rhymes. f(4,3) = 6 Is there an easy formula for f(l,r)? Suppose we already know f(l-1,r) that's how many ways there are to make an l-1-line poem with r rhymes. Well, if add an additional line, and preserve the notion that there are r distinct rhymes, the additional line must match one of the r rhymes already in use. So this gives r x f(l-1,r) ways to do it ... so far. Let's say we already know f(l-1,r-1). Now if I add a new line to the bottom, to have r distinct rhymes, that new line CAN'T possibly rhyme with any others. So, that's another f(l-1,r-1) patterns. f(1,r) = r*f(l-1,r) + f(l-1,r-1) BASE CASES: f(anything,1) = 1 f(l,r), where r > l is zero. How many ways are there to rhyme a four-line poem? 1 2 3 4 r 1 1 0 0 0 1 2 1 1 0 0 2 3 1 3 1 0 5 4 1 7 6 1 15 5 1 15 25 10 1 52 f(2,2) 2*f(1,2) + f(1,1) f (3,2) = ASIDE: g(l,r) = g(l-1,r) + g(l-1,r-1) 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1