SymPy and the GSoC

Google has announced the results for Google Summer of Code. The following projects have been accepted for SymPy:

(Project, Student, Mentor, Link to proposal on the wiki)
– Category Theory Module, Sergiu Ivanov, Tom Bachmann
– Density Operators for Quantum Module in sympy.physics.quantum, Guru
Devanla, Brian Granger (co-mentor Sean Vig)
– Enhancements to sympy.physics.mechanics, Angadh Nanjangud, Gilbert Gede
– Group Theory, Aleksandar Makelov, David Joyner (Aaron Meurer co-mentor)
– Implicit Plotting Module, Bharath M R, Aaron Meurer
– Vector Analysis, Stefan Krastanov, Matthew Rocklin

I will help mentor Aleksandar Makelov’s work on group theory. He is a freshman at Harvard.

A remark on mathematical research

Ira Glass, of This American Life (, did an excellent four-part interview where he talked at length about writing news stories. They are here:

Ira Glass on Storytelling:
part 1 of 4
part 2 of 4
part 3 of 4
part 4 of 4

I thought a lot of what he said was based on general principles which applied to mathematical research as well. Here is perhaps what he would have said if he was talking about mathematics, sometimes with direct quotes from his interview:

There are two building blocks to a idea for a paper

  1. The problem or question. This is sometimes an issue in the intersection of two fields or a question of why some object of interest behaves the way you think it does, based on an example you know.
  2. The revelation. This might be a key example or technique that will hopefully reveal the answer to your question.

You can have a great question, but if they don’t turn out to have any useful techniques or examples to work with, your idea is uninteresting. Conversely you can have a significant revelation with a fantastically powerful method, but if the problem or examples themselves are uninteresting, again you’ve got a weak idea.

You have to set aside just as much time looking for good ideas as you do producing them. In other words, the work of thinking up a good idea to write about is as much work and time as writing it up.

Not enough gets said about the importance of abandoning crap. Most of your story ideas are going to be crap. That’s okay because the only way you can surface great ideas is by going through a lot of crappy ones. The only reason you want to be doing this is to make something memorable and special.

“The thing I’d like to say to you with all my heart is that most everybody I know who does interesting creative work went through a phase of years where with their good taste, they could tell what they were doing wasn’t as good as they wanted it to be … it didn’t have that special thing they wanted it to have … Everybody goes through that phase … and the most important thing you can do is do a lot of work.”

Sestinas and Sage

According to [1], a sestina is a highly structured poem consisting of six six-line stanzas followed by a tercet (called its envoy or tornada), for a total of thirty-nine lines. The same set of six words ends the lines of each of the six-line stanzas, but in a shuffled order each time. The shuffle used is very similar to the Mongean shuffle.

Define f_n(k) =  2k, if k <= n/2 and f_n(k) = 2n+1-2k, if k > n/2. Let p = (p_1,...,p_n) \in S_n, where p_j = f_n(p_{j-1}) and S_n is the symmetric group of order n. From [2], we have the following result.

Theorem: If p is an n-cycle then 2n+1 is a prime.

Call such a prime a “sestina prime”. Which primes are sestina primes?

Here is Python/Sage code for this permutation:

def sestina(n):
    Computes the element of the symmetric group S_n associated to the shuffle above. 
        sage: sestina(4)
        sage: sestina(6)
        sage: sestina(8)
        sage: sestina(10)
        sage: sestina(12)
        sage: sestina(14)
        sage: sestina(16)
        sage: sestina(18)
        sage: sestina(20) (1,2,4,8,16,9,18,5,10,20)(3,6,12,17,7,14,13,15,11,19) 
        sage: sestina(22) (1,2,4,8,16,13,19,7,14,17,11,22)(3,6,12,21)(5,10,20)(9,18) 

    def fcn(k, n):
        if k<=int(n/2): 
            return 2*k 
            return 2*n+1-2*k 
    L = [fcn(k,n) for k in range(1,n+1)] 
    G = SymmetricGroup(n) 
    return G(L)

And here is an example due to Ezra Pound [3]:


Damn it all! all this our South stinks peace.
You whoreson dog, Papiols, come! Let’s to music!
I have no life save when the swords clash.
But ah! when I see the standards gold, vair, purple, opposing
And the broad fields beneath them turn crimson,
Then howl I my heart nigh mad with rejoicing.


In hot summer have I great rejoicing
When the tempests kill the earth’s foul peace,
And the light’nings from black heav’n flash crimson,
And the fierce thunders roar me their music
And the winds shriek through the clouds mad, opposing,
And through all the riven skies God’s swords clash.


Hell grant soon we hear again the swords clash!
And the shrill neighs of destriers in battle rejoicing,
Spiked breast to spiked breast opposing!
Better one hour’s stour than a year’s peace
With fat boards, bawds, wine and frail music!
Bah! there’s no wine like the blood’s crimson!


And I love to see the sun rise blood-crimson.
And I watch his spears through the dark clash
And it fills all my heart with rejoicing
And prys wide my mouth with fast music
When I see him so scorn and defy peace,
His lone might ’gainst all darkness opposing.


The man who fears war and squats opposing
My words for stour, hath no blood of crimson
But is fit only to rot in womanish peace
Far from where worth’s won and the swords clash
For the death of such sluts I go rejoicing;
Yea, I fill all the air with my music.


Papiols, Papiols, to the music!
There’s no sound like to swords swords opposing,
No cry like the battle’s rejoicing
When our elbows and swords drip the crimson
And our charges ’gainst “The Leopard’s” rush clash.
May God damn for ever all who cry “Peace!”


And let the music of the swords make them crimson
Hell grant soon we hear again the swords clash!
Hell blot black for always the thought “Peace”!



[2] Richard Dore and Anton Geraschenko,”Sestinas and Primes” posted to, and

[3] Ezra Pound, “Sestina: Altaforte” (1909), (originally published int the English Review, 1909)

[4] John Bullitt, N. J. A. Sloane and J. H. Conway ,