Profile cover photo
Profile photo
David Ratnasabapathy
I read a lot and I teach Math.
I read a lot and I teach Math.

David's posts

Post has attachment
Google search operators help find your missing mail

If you, like me, are a packrat who hates deleting mails (you might really need it some day!) you have a massive yet poorly organized inbox and outbox.

And comes the day when indeed you must find a particular message you sent a friend -- how do you find it, when you have literally hundreds of mails to search, and no good idea what you said?

Well if you, like me, know roughly when you wrote the message you're looking for, be flummoxed no further.  gmail's search bar will find it for you.  Type this:

to: after:2008/04/01 before:2008/04/30

Presto, just a few messages to sift through!

Gmail's search operators are varied and powerful.  Check the link above!

Post has shared content
How to remember the difference between Mitosis and Meiosis
Forgive me, I keep forgetting!  Mitosis describes the process through which a cell makes an exact copy of itself. Mitosis is how a fertilized egg cell divides and divides to make you. In Meiosis a cell makes two divides into daughters, each of whom have exactly half the chromosomes of their mother. Meiosis is how we make the sperm and eggs that merge to make that fertilized egg cell.  The problem is that I can never remember which is which.

Here +Rajini Rao shares a most well-crafted poem, the solution to this problem.  Enjoy!
Ode to Mitosis

Mitosis is a process
For One cell to become Two
There are Four distinct phases
Happening within You

First comes Prophase
The Chromatin strands condense
They now become visible
Through a microscope lens

Next comes Metaphase
The important Stage Two
Chromosomes attach to Spindle Fiber
Using Molecular Glue

Then comes Anaphase
It's really quite sad
Sister Chromatids separate
To opposite poles- too bad :(

Finally, it's Telophase
Nuclear membranes reform
Spindle fibers disperse
And Two new cells are born.

Poem: Playfully plagiarized, willfully altered and spell-checked from the original "reallygoodpoetry" at

Images: Gifs from
Watch original movie here:

2 Photos - View album

Post has attachment
How to enter a frequency distribution into R
R is an incredibly sophisticated piece of statistical analysis software.  It's free too.  Runs on everything --- Windows, Mac, Linux.

Me, I'm a novice.  Given a set of data, I just want R to tell me its sum and its sum of squares.  When the data's in a list, like this ---
x : 1  1  1  3  3  3  3  4  4
It's easy.  Issuing the command
>   x <- c(1, 1, 1, 3, 3, 3, 3, 4, 4)
Will store the data inside the vector x.  The commands
>  sum(x)
>  sum(x^2)
Will return the sum of data values and the sum of squared data values respectively. 

Trouble starts when the data's given in the form of a frequency distribution.  The data above is as easily (and more legibly) described by the frequency distribution
x :  1  3  4
f :   3  4  2
Now the 'x' row lists the distinct values we observe; the 'f' row shows their frequencies --- how often each value occurs.  So data value 1 has frequency 3, telling us that 1 appears three times in the list of data; data value 3 appears four times, and data value 4 appears twice.  How do we get the sum and sum of squares now?  One way is by brute force. For the sum, do
>  sum(f * x)
And for the sum of squares
>  sum(f * x^2)

But that's inefficient.  Instead of letting R's statistical functions extract information for us, we're just using R as a primitive handheld calculator.  Is there no better way?  If only there were some way to efficiently extract the data set {1, 1, 1, 3, 3, 3, 3, 4, 4} defined by that frequency distribution above!

And what do you know, there is.  The `rep' command, which repeats vectors in various complicated ways, will do that for us!

First store the frequency distribution in R.
>  x <- c(1, 3, 4)
>  f  <- c(3, 4, 2)
The vector x now contains the list of values and the vector f contains their corresponding frequencies.  Use the rep command to repeat the x values as specified by f.  Do
>  y  <- rep(x, times=f)
And that's it!  The data's been extracted and stored in vector y!
>  sum(y)
>  sum(y^2)
Will return the sum and sum of squares.

#math #statistics #R  

Post has attachment
The Google Doodle celebrates Sri Lanka's Independence Day

I suspect this appears only for people browsing from Sri Lanka, but it's sweet nevertheless.  The colours of the doodle echo the colours of the Sri Lankan flag; the Lion is the symbol on that flag.

It has to be said, our successive governments' commitment to Liberty, Equality and Justice haven't been, ah, ideal; but no horror they have ever perpetrated could match the nightmare of centuries of foreign tyranny.  Good riddance.

Post has attachment
What a six-figure advance _really_means
Charles Stross explains the sad truth.  Yes, popular authors are offered vast sums by publishers for their books.  But those vast sums are spread out over years.  And they require a continuous output of books --- you know, work.

It sounds great, but when you break it down and look at the small print, it was £1M for ten books, delivered at a rate of one a year. Minus a 15% cut for his agent. With joint accounting and world English language rights (at least) thrown in. And payable in small pieces. Upshot: a £85,000 a year salary for ten years (and you can be damned sure Gollancz inserted some termination clauses in the contract in case things didn't go according to plan).

And that's the successful ones!  If you're planning on writing for money,

1.  John Scalzi's book, You're Not Fooling Anyone When You Take Your Laptop To A Coffeeshop, is an excellent introduction how to.

2.  Don't give up your day job.

Post has shared content
This is fascinating, because it takes something so commonplace that we barely notice it, and explains how it came to be.  I love articles like this.
Forever in blue jeans...

 • Blue denim jeans are worn and loved the world over by many people. Worn by Presidents, celebrities, farmers, housewives, college kids - they are comfortable, durable, cool and sexy.

• As described in the book 'Denim: from cowboys to catwalks - a visual history of the world's most legendary fabric' by Graham Marsh and Paul Trynka, "Denim links dustbowl cowboys and high fashion models. It is both a symbol of the counterculture and the generator of huge amounts of money. It is a simple fabric, dating back to 18th-century France, which has become a symbol of street credibility and sex appeal.The book describes the evolution of the denim business, from pioneering brands like Levi's, Lee and Wrangler to its use by high fashion houses such as Alexander McQueen, Vivienne Westwood, Ralph Lauren and Calvin Klein.

·• Blue denim jeans
Ever wondered where the blue colour of blue jeans comes from, and why denim cloth is different to other fabrics?
The blue dye is Indigo which is a natural dye extracted from the plant Indigofera tinctoria, It is an organic compound with a distinctive blue colour, primarily used to dye cotton yarn which is used in the production of denim cloth.On average a pair of  jeans needs 3 - 12 g of dye.The denim fabric is woven in a special way so that the blue is visible on the outside of the garment while the inside remains white.

Obtaining the blue dye from the plant
The plant Indigofera tinctoria contains 0-2 - 0-8% of a compound called 'indican' which is the precursor to the blue dye indigo.
Indican is a colorless water soluble substance which readily hydrolyses to form 'indoxyl', which in turn gets oxidised to indigo on exposure to air. Indican was obtained from the leaves of the plant by soaking them in water and fermenting to produce the blue dye. Different shades of blue and purple were produced from the precipitate of the fermented leaf solution.

Synthetic dye
The indigo dye used today, to produce denim cloth is synthetic. Indigo has been prepared by many methods, as far back as 1882 by the  Baeyer-Drewson indigo synthesis. However, the first practical synthesis is due to Pfleger in 1901. In this process, N-phenylglycine is treated with a molten mixture of sodium hydroxide, potassium hydroxide, and sodamide.

How denim cloth is woven
Denim cloth is woven with two yarns - one dyed indigo, the other undyed. Indigo yarn is most visible on the outside, undyed yarn on the inside
It is described as a 'rugged cotton twill textile', in which the weft passes under two or more warp threads, called the 'twill' weaving which produces the familiar diagonal ribbing of the fabric.
It is characteristic of any indigo denim that only the warp threads are dyed, whereas the weft threads remain plain white. As a result, one side of the fabric shows the blue warp threads, the other side shows the white weft threads. This is what makes the fading characteristics of denim jeans so unique compared to other fabrics.

Blue denim jeans will live forever...
(image credit:
For +ScienceSunday curated by +Allison Sekuler +Robby Bowles +Rajini Rao +Chad Haney +Buddhini Samarasinghe 

Post has attachment
The Y chromosome is not decreasing in size
One downside of this getting older business is that some of the stuff you learned turns out not to be true.  Take the Y-chromosome.  it's not the smallest chromosome (Chromosome 21 is) but it's still tiny.  And that makes sense: we expect it to disintegrate over millions of years.  Because it's the one chromosome that doesn't exist as a pair.  Mutations on the Y can't be corrected or ameliorated by an undamaged partner.  It's reasonable that mutations that shift genes off the Y onto other chromosomes would be selected for.

But "it makes sense" and "it's reasonable" must meet the test of science.  They did.  They failed.  The Y chromosome is stable!

h/t: +Rajini Rao 

Post has attachment
xkcd on living with cancer

...the panel with the whale brought a tear to the eye.

Post has attachment
Safewords are not just for sex

What a great idea!  Have safewords for every interaction!

Post has attachment
Holy Moses the pain women willingly go through!
Lousy Canuck describes her experience getting fitted with an IUD.  Bear in mind that she went through this of her own free will.

Then the IUD went it and it was like getting stabbed in the belly three times, one more painful than the last. ... Then the cramping began.

I laid on the bed for a long time as my body effectively screamed “GET OUT GET OUT GET OUT”. I was told the cramping should subside in about 20 minutes but that is not what happened...

Wait while more posts are being loaded