Tuesday, 11 June 2013

Snaps

Today morning while looking out of the corridor,into the mud-puddled roads of the hostel suburbs, i liked the idea of capturing so simple a scene from so ordinary a day.
The road with few commuters

Desolate car

Sinister


The play and the stage

Monday, 10 June 2013

Coupled Springs

Coupled differential equations are ubiquitous.You can find them anywhere from a creaking chair to human interactions. They are important not only from a physics point of view about solving coupled springs or coupled LCR circuits or in chemistry for knowing how reaction rates behave or in biology for knowing the population dynamics or in economics for knowing how markets behave but something bigger than that. Coupled equations are the underlying thread which connects every activity to every other activity.And it is not at all a bad assumption to allow for other systems interacting with your system or vice versa. It is not possible,except in very clean physics experiments(and too with difficulty), to seperate the concerned quantity with other related quantities,many a times,it might be that we are interested in the interaction itself or sometimes wanting to seperate it. Differential equations govern the dyanmics of any system and since nothing is independent on this universe,everything is linked to everything,we need to consider and perhaps only consider coupled differential equations to predict future of the system (it could be the world,who knows).
So to give a flavour of it.I will start with a simple example of two springs linked to each other.
Some notes
1. You can use any mathematical software to get these equations automatically solved (like Mathematica,Matlab).Also online www.wolframalpha.com can solve equations for you.
You need not visualise these equations as connected springs,it could be anything such that the dyanmics of our desired qunatity x1(position of spring from equilbiria, no of rabbits, conc. of chemical etc) id affected by certain other connected qunatity(another spring, no of mothers,chemical's quencher etc).
Consider the following coupled differential equation.
  d^2 x1/ dt^2 = - x1 + e x2
 d^2 x2/dt^2 = e x1 - x2
So here if e was zero,we would say that the system of equations are independent and their solutions are obtained every easily.
 d^2 x1/dt^2 = -x1
 d^2 x2/dt^2=-x2
An ansatz like x1= A exp(i t) +  B exp(-i t) and x2=C exp(i t) + Dexp(-i t) works.
How we came about this guess is also an interesting story (which includes the power series of solving differential equation) which i hope i will cover in some other post.
But the picture till now is: given independent differential equations,we can solve it and find out the dyanmics of the system quite easily.
whose solution when plotted with respect to time shows sinusoidal behaviour as expected due to presence of cos and sin term in the solution (Euler's formula).
Now when we introduce the dependence of our independent springs on each other (probably by connecting them),then we can manipulate the strentgh of connection by changing the magnitude of e.
First of all,how to solve such a kind of equation.
Simple answer is,give it to some mathematical software like Matlab who will solve it for you.

If you dont want to read further and know the answer.
 For e=0.001


The first image is for the first equation,and second image for second equation.
For e= 0.1


First image for first equation
second image for second equation
e=1


It would be better if we plotted them together




Notice how the systems have coupled themselves together such that behaviour of one is enough to predict the behaviour of other one.
The extent of coupling allows us to know the other systems better and better by knowing the dynamics of just one system (provided we also know the type of coupling ,linear,quadratic,exponential).

Otherwise,
Note the any linear operation on vectors which live in a vector space (defined over the complex field) is just transforming a vector from one form to another in the same vector space.say you had the vector (3,2) and you mutiply it by a matrix ((0,1),(1,0)) which will flip the x and y coordinates of the vector and hence take it to another place in the same space.Since every abstract vector space can be operated on by using a basis (a basis makes any abstract vector space look like C^n or R^n depending on your field),any linear transformation corresponds to mutlitplyign the vector by a matrix which transforms the vector.
Matrix multiplication is a simple thing.Ain't it?
But realise that the operation d^2/dt^2 is also linear on vector space V,such that it L(x+y) = L(x) + L(y) and L(c x) = cL(x),here L = d^2/dt^2.
Now that we know this double differentiation operation is linear,we can diagonalize it which means seperate the vector space into smaller subspaces such that any vector can be uniquely decomposed and each component of the vector is contained in these invariant subspaces.
But there's a theorem that whenever a matrix/linear transformation has distinct eigenvalues,it is diagonalizale. So lets check if our matrix of linear transformation is diagonalizable. (just check if its determinant is non zero).

Yet to be completed.
i will go through
1. diagonalizing the matrix of linear transformation and decoupling the given system of equations
2. How does the dyanmics depend on intital points (so called phase factor)
3. Extent of coupling.
4. Non linearity.

Friday, 7 June 2013

The Hardy Weinberg rule

 Population is a word which has been deduced as very important because of its relevance to ecology and evolution. Nobody knows what it exactly is,but they define it to be a group of same kind of people.For technicality,'kind' means species and people means an indivduals who can be any living thing which can reproduce.
It is good to imagine 'population' as a community of individuals of hens(choose your favourite animal) living in a place which is surrounded from all sides by mountain so they can't get out or for that matter,nobody can come in. The bussinesss of food and sex is left for reader to choose and imagine in the above context.
If you don't want to read all of this and want to learn Hardy-Weinberg law,please understand  that it is not a very big thing ,it just says a very simple thing which is as follows. If you have a pair of dice of red and blue color and someone else has both red color and some might have blue colored ones,but everyone has a pair of dice.Now you can count the total number of dice and figure out say 70% of dice are red and 30% are blue. But still the people holding red pair of dice say 48% and blue colored dice pair are 37% and the people with mixed color dice are 15%. Now if all of you throw your dice in a tub and mix it and pick two dice up,the proportion of people holding blue pair dice would 9% ,red pair dice 49% and mixed color dice 42%.And if you repeat the game,same thing will happen.THe reason is as simple as this,if you mix things and randomly pick again,frequency of getting something is equal to probability of drawing a pair of things from an urn or something without replacment. Nowgo read the text.
Now you ask, i see somewhat different kind of hens here.There are 1000 hens(what a feast it would make), some are white colored,some are red colored and some pinkish. How could this happen.These all have the same kind of meat and egg,why be different. Why couldn't everyone be same.
Well,if you think of a context when suddenly a fox or an eagle(who eats hens) came into the mountains and hens didn't know where to go. They will be killed,of course but who will be killed first.
Fox is color-blind,it can only see difference in white and black(and their linear combination).So would it observe the white hens or red hens first. My bet is on white hens. Say it did,and it will go and grab and eat 'em up.
Now he's full and everyday he starts eating these hens at a rate of say 1 hen per say.
Now hens are no foolish,they can have sex. They will go, find a cock and mate. Now white hens mating with white cocks can give rise to two different kind of offspring ( i am not talking about its gender). The offspring could be pink or white.
To make matters more concrete,lets do some number crunching with notations.or in other words,make a model.
DNA is unit of heredity.What you pass to your son is not only your wealth(to sons it seems to be the only thing),definitely not your blood(like in movie they keep on mentioning the blood) but your DNA and also what you are is the combination of DNA of both your mother and father(ask your dad,mom might be shy).
Since DNA is the only thing which is passed from parents to offspring, a DNA has to have information ,in principle,to construct an entire human being (you).
That means DNA determines your hair color, your lungs bronchioles density,the eye color and maybe starch content(if you are a pea).
Now the color of hens is determined by their DNA.
Different colored hens have different DNA. And egg production(and hence offspring) requires sex,that means the offspring must be getting two of those DNA's. So we can think that everyone alive must have two DNA's.But characteristics or technically phenotype is determined by combination of both DNA's so you cannot expect same character as parents to show up in offspring or their mixture for that matter and some traits may not be visible but be there(those are called carriers) and show up in some other generation(although Caucasian parents cannot possibly have black kid).
So lets symbolise.
Red hens have AA DNA or gene,if you will(AA because there are two copies of A).
White hens have BB gene.
Pink ones have AB or BA. (dont worry its commutative,not like the quaternions).
So we try to find out what would be gene frequency/proportion dynamics when their was no fox and couple of other assumptions.
What is proportion of A genes in the population
total no of A genes = 2 copies per hen of red color + 1 copy per hen of pink ones
 total no of B genes = 2 copies per hen of white color+ 1 copy per hen of pink ones
total no of all genes = total no of hens *2 (since every hen has 2 of them)
Let us say p (its not convenient or something but it gives a feeling of what i have learnt) is the frequency of A genes in the population and q is the frequency of B genes.
Naturally p= total no of A genes/ total no of all genes
q= total of B genes / total no of all genes
And p+q= (total no A genes + total no of B genes)/(total no of hens)
          =1

Say red hens (AA) are P in proportion.
White hens (BB) are Q in proportion.
Pink ones(AB) are R in proportion.p = (2 P + R) /2(P+Q+R) = P + R/2

q= (2 Q + R)/2(P+Q+R) = Q+ R/2
 Notice P+Q+R=1
Say out of 1000 hens there are 238 white hens, 478 red ones ,rest you figure out.
P = 238/1000
Q= 478 /1000


Its not so vague as it looks,just put some numbers.

So p =(2*478 + (you figured))/2000 = 0.62
q= (2*238 + c'mon)/2000 = 0.38
Now if just get to figure out how this frequency changes after every mating(from now on sex is for humans,mating is for animals) we would be able to say how many of each color are present in each generation,all you have to do is to multiply the gene frequency by the total no of people in the population.
like in above case you wanted to know how many of each color are there
for red hens.
no of red hens = frequency of red hens * total no of red hens
                      = 0.62 * 0.62 *1000
                     = 384.4
WTF. we had 478 red hens and calculation shows only 384 (give or take) hens.
Clearly something is wrong (or wrongly assumed).
The equation
no of red hens = frequency of red hens * total no of red hens
is assuming that if we have A gene and B gene in population and we randomly pick two genes (hence making an individual) ,then the probability of picking two A's with(actually it does not matter much here,if it did you could take 10^5 hens) replacement is p*p. And hence there must be p*p*total hens amount of red hens.
But we are drawing our sample from a thoroughly mixed box of genes,which might be a wrong assumption for this generation.
Now since the mating would be random and genes will get mixed,we will show later that in the next generation(and henceforth) the above equation will start working. This is the famous(i dont know why) Hardy Weinberg Law.

So one assumption we make now is that the mating is random i.e unlike human society ,no male in hens have mating with a female just becoz she is white (or red).
So to know the gene frequency in next generation of kids (when the current hens are dead,they have die before kids start mating,take it as an assumption or kill the old hens) we need to know what is the mating frequency.that is how often do people mate.Obviously,if some kind of hens are more in number,they will mate more often(not the same individual,the same kind).
Frequency of mating is directly proportional to the number of hens for the mating group
lets make a table of all possible matings. of course,Aa * aa is same as aa *Aa, remember mating is multiplicatively commutative(unfortunately it does not form a vector space because of addition operation not being defined).
 All possible kind of matings are
AA * AA
AA *AB
AA *BB
AB *AB
AB *BB
BB* BB
Mating frequency is just the product of the number of each type of individual
mating type mating frequency
AA * AA                P*P           
AA * AB                P*R
AA * BB                P*Q
AB * AB                R*R
AB * BB                R*Q
BB * BB                Q*Q
 Now we want to know what kind of offspring each of the different type of mating will give rise to.
For this, since i don't have the patience to write, i copy.

Mating type Mating frequency How many will be AA How many
AB
How many
BB
AA * AA P*P all 0 0
AA * AB P*R half half 0
AA * BB P*Q 0 all 0
AB * AB R*R quarter half quarter
AB * BB R*Q 0 half Half
BB * BB Q*Q 0 0 all

Wherever you see half or quarter,it means that out of all the matings in the respective mating type,how many of each type would be produced,to see the logic behind the values,visualise from a given mating type (say AA*AB) choose A sperm from (AA) and A egg from AB,you will get AA as final product or if you choose A from AA and B from AB,you will get AB as final product,the probability of AA producing A sperm is 1 while the probability of AB producing A or B is half each. And mating implies multiplication of probabilities.
Making the table more quantitative

Mating type Mating frequency How many will be AA How many
AB
How many
BB
AA * AA P*P 1 0 0
AA * AB 2 P*R ½ ½ 0
AA * BB 2 P*Q 0 1 0
AB * AB R*R ¼ ½ ¼
AB * BB 2 R*Q 0 ½ ½
BB * BB Q*Q 0 0 1


New P P*P +2P*R/2+ R*R/4 (P+R/2)^2 p^2


New R 2 P*Q + 2R*Q/2+2P*R/2 2(P+R/2)(Q+R/2) 2pq


New Q Q*Q +2 R*Q/2 + R*R/4 (Q+R/2)^2 q^2

Now look at the last three rows of this column
we have predicted the frequency of observing red hens ,white hens and (jeez) the pink ones too. 
Number crunching starts.
P (the red ones) will be observed (0.62*0.62*100)=38.4% of times
R (the pink ones) will be observed (0.62*(1-0.62)*100)=47.1% of times
Q(the white ones) will be observed (0.38*0.38*100) = 14.4% of times
by the fox. 
So the no of hens in a population of 1000 is 
384 red ones, 471 pink ones,144 white ones.
Observe that this number is same as what we predicted sometimes back from random mating of people and stuff like that. 
The result is nothing more tough. In general, whatever be the color frequency of indivduals in the population, their gene frequecies are say p and q for 2 colors, after one round of mating,in which,all the information about the number of red hens and white ones is lost,what you will see is the combination of red,white and pink with a frequency of p^2, q^2 and 2pq.
Notice the change we see saw in our population.
The gene frequnecy never changed .
p = 0.62 and q=0.38
only its distribution among individuals changed.
Initially we have 62 % red and 38% of white gene in the whole population but 478 red and 238 white and 284 pink ones.
After all the genes got combined and were again randomly distributed among individuals,there are
 384 red ones,144 white ones, 471 pink ones.
Now this number cannot change until and unless some males start liking some females(of a particular color) more than other(non-random mating) or the different color provide different survival advantage to the hens which is true for our fox who eats only white (natural selection acting). 
On a different note, this tells us that fundamental process of mixing can prevent a population from losing out some gene. A gene being in low frequency does not mean that eventually by mating after several generations it will be gone.No.Rather in simplistic cases, it wont. 
On a different(er) note, G.H Hardy was a mathematician who figured this law out in a conversation with Punett (why does a matrix get to be called punett square) regarding the population still having deleterious genetic diseases which are still not gone (which is by virtue of carriers). 

Wednesday, 5 June 2013

Webb et al, the paper that couldn't be more wrong


http://www.sciencedirect.com/science/article/pii/S0003347299912150
I discuss certain points here in this paper which seem utterly wrong to me and also  expres my disbelief at what all can get published. If i were to speak, game theory already developed quite nicely by 1960's was applied for the first time in biology in 1980's by Maynard Smith (that's why he is the father of biological game theory or something like that) and that too wrongly.
Seeing the lack of consistency for a long time is disheartening.
What were the reviewers doing.Or were they not trained in the subject. 
Points to discuss:
1. "
Although Maynard Smith’s model has been very influen-
tial, it cannot explain multiple patterns of care."
Because it was wrong.
2.
"
There are
three obvious ways in which multiple patterns of parental
care might appear. First, the ESS may consist of mixed-
strategy behaviours, that is, either or both of the parents
should desert with a probability between one and zero.
Second, behaviour may be time dependent with parents
changing their care decision during the breeding season.
Third, there may be differences in quality between indi-
viduals leading to different care decisions being made
depending on the qualities of both parents."

The first reason covers everything,by definition.
 3.
"
In Maynard
Smith’s ‘model 2’: (1) there are no mixed ESS solutions
since an individual’s behaviour can depend on its sex,
and the payoffs for care and desertion are fixed (Selten
1980; Maynard Smith 1982, page 107); (2) it describes a
single, time-independent decision; and (3) the individ-
uals in the population are identical."

Again the reasons are not necessary because he was wrong.

4.
“let us suppose that the population is following the strat-
egy of female care and male desertion. The condition for
male desertion to be optimal, given that all females in the
population are caring (y=0) and all males are deserting
(x=1), is V1 +rm(1,0)V2 >V2. However, with rm(x,y) given
by equation (5) we have rm(1,0)=0 since there are no
females available with which to mate. Thus for uniparen-
tal care by the female to be an ESS, it must be the case that
V1 >V2 which contradicts our original assumption that
biparental care is better than uniparental care. The failure
to satisfy the condition for uniparental female care is due
to our choice of functions for the remating probabilities. ”

They accept their mistake,in fact the whole formulation becomes wrong and still they continue talking about it.

5.
“If none of the females in the population participated in
the first breeding attempt (for example, because they had
not yet arrived on the breeding site), then some females
may be available even though the number of deserting
females is zero. ”
Who are you kidding?
If all females are caring,how the hell do you plan to get those additional females from. If from somewhere else,then sorry,your model has unknown elements coming in and going out which is terribly not acceptable.
Experiments cannot be always in experimenter's control but you cannot do that to a model.

6.

If Webb et al had chosen the matrix payoffs carefully,they would have gotten exactly the same results as our model 0.
And we wouldn't be doing that and reading it in their paper.

7."
In Appendix 2 we show that, in the standard replicator
dynamics (Taylor 1979), the corresponding polymorphic
populations with x* as the proportion of deserting
individuals are asymptotically stable under the same
conditions on V1/V2 as for the ESS solutions."
Why should they be any different ?Finding ESS is same as finding the fixed points of certain game which is stable (asympotically).
Replicator dynamic kind of analysis is enough.
In ESS kind of analysis ,people directly compare payoffs of different strategies ,which is essentially the same for replicator dynamics except that it gives you an additional structure and also a mechanism to generate the whole game being played in real time. like you can monitor the allele frequency change by iterating the game.

 
 

 





Tuesday, 4 June 2013

Precipitation

Rains are often associated with only two feelings,other people just don't associate their lives with changes of weather,those are generally the ones who live in closed environment where weather changes become immaterial to them.The closest they come to associating their lives with weather is when internet gets disrupted by weather or if they get to stay at home due to the heavy rains. Irrelevant to my topic,the two feelings people associate most with coming of rains are those of gloom or liberation.Both when the said person is alone,coz when he is in a group,those people will ruin the gloominess of it or liberation part.Gloominess because you are stuck on something or you don't know where your life is going at the very moment or perhaps you like feeling sad.liberation when you decide that nothing matters,it is just another moment in your life and one of the best commandents of life 'This too shall pass'.
It leads to some local changes in life,that means,these changes are temporary and you will get back on track once the new day begins. 

Sunday, 2 June 2013

Novels

These days a lot of craze is around for new novels,recently released ones from a famous author and how soon one finishes to tell others about it.
First of all ,to those people who belong to the above category,
WHO CARES?
Read it yourself and keep it to yourself. There are not many illiterate bastards around who would be dying to hear a so-called new story for a change.Your life is boring, get past it. Yeah,kill yourself.
After reading an author's one book, a person knows to have found an extremely new concept missing from the whole imaginary world of stories(not the complex plane,its not even a subspace of C). Then after the second book of author, the person realizes that it was a different story with perhaps the same cast (you have to doubt your conclusions coz author will never tell you this).Then after the third book,you seem to be getting the point of author about trying to bring out a particular element in each story like the hero in the start is the villain in the climax.
Beleive it or not,after the fifth book,you will realise ,it was after all the same story,set in different context, you are robbed.Sue that SOAB.
This happened to me. Yes,sympathy accepted.
I had thought that my entire life would not be the same if i hadn't read 'The Alchemist' by Paulo Coelho, i used to revere that guy. It was like the masterpiece,which could never be written again. Then i read 'Eleven Mintues' which was the most awesome book i had ever read,and still is,as a matter of fact,perhaps because of its erotic content and a good story and lot of morals. But then i read more of his 'Zahir' , 'The Valkyries', 'Devil and Miss Prym' ,'Veronica decides to die', 'The Witch of Portbello', 'Like a flowing river', and one more,the ugliest one called 'brida' and then i had realised that this author could not stop talking about something spritiual which different people buy because they think they know it ,'Soul of the universe' , 'Beginner's luck' whatever it means.The hurting part is that the guy writes about himself in every story,he is the hero. I thought this was the case with only Paulo,there was no reason to blame others. And then i tried Dan Brown, 'Angels and Demons','Da Vinci Code','Digital Fortress' these were the same stories written in different context.And then began my journey of classifying authors.The proposition being 'each author has only one story to tell'.Rest all are transformed,deformed,permuted etc from the one main story the author ever told.
So my fascination for different books by the same author reduced and now i only buy when i think the book has reached sufficient acclamation to be called 'unique'.

Saturday, 1 June 2013

' Never let the truth get in the way of a good story'
                                                                                  -Nucky Thompson
                                                                                   Boardwalk Empire season 1 



Once there was a young boy who did not knew much of the world outside.Being pretty naive and reluctant to ask, he was a loner and living in a countryside mansion, it didn't hurt much.
His rich Victorian parents worried about him suggested to get him a teacher who would interact and also developed his mental faculties.Being people of means,they wanted to choose a teacher once and for all so that he could be useful to the lad "forever",whatever that means. 'He' because of avoiding the son to even think of women cause he had never seen them except his mother and maids who were chosen deliberately to be plump and haunting.
From long searches over different continents,they came across one who had recently graduated student from India. They knew indians were good intellecutals but that didn't mean every indian was an intellect. Their statement was based on the fact that they had seen many intellectual indians but not seeing one does not mean that it did not exist. Pretty much like flowering of bananas,which happens only once in their lifetime and nobody is around when its happening ,just before and after it.
Hence, they had to put him to a test. Not like the Tripos or Putnam fellow kind of test which one had to clear only if he thought he was one amongst the few gods living on earth.  'He' because not many females did succumb to these norms of testing.Questions would be based on all subjects and answers to be decided by a jury including the mother and father and some academicians form the local university from different subjects. Texts ranging from Evolutionary psychology to Astrophysics, guitar playing to drum beating, story telling to novel writing, C to Mathematica, prime numbers to RSA algorithm,Chemical thermodynamics to Engineering Design, Khomeini to Einstein, everything was to be covered,tried and secured.They deliberartely left out a few subject in acknowledging the fact that everything could not be known and if everything was to be known by someone, he would be named 'Encyclopedia Brittanica' or perhaps ' God'.
To set the rules of the questionairre and since so much was being asked(this fact was acknowledged by the academician not the parents) they decide to allow the fellow 1 pound of material for the purpose of his browsing through,in case he got stuck.
A curious incident happened just before the day of arrival of young dark indian gentleman. The incident is not of much importance,rather its sensitivity to the story's turning points. The small boy was studying mathematics as a hobby since a long time ,of which Euclid's 'Elements' was his favourite.Incidentally,the academician who was having supper walked into the little boy's study(if a small table with few book be served the honour) and asked him if hew knew of something called 'Fermat's last theorem'. To everyone amazement the boy politely refused(if you get the irony). 

Story yet to be completed.