### Interlude: calculating the sum of squares

This is the seventh in a series of posts about Student's*t*test. The last post has a list of all the previous posts here.

The PyCogent two-sample t-test uses an interesting method to calculate the sum of squares

`(X - mean(X))**2`

. Here is my transcription and a comparison to a more usual approach:We do five trials and compare the results.

Clearly, it works. The question is, how?

Using the code listed at the bottom of the post, examine the calculation.

But I am stuck in the process of figuring out why they are equivalent.

I don't seem to be able to reach:

Any ideas?

[UPDATE: I got an answer from Srikant Vadali here, and will discuss it sometime soon.]

Remainder of the code listing: