Tuesday, March 26, 2013

Reading Think Bayes

I have started reading the book http://www.greenteapress.com/thinkbayes/html and thought of posting some interesting stuff i read.
Here is a problem from chapter 3:

Suppose I have a box of dice that contains a 4-sided die, a 6-sided die, an 8-sided die, a 12-sided die and a 20-sided die. Suppose I select a die from the box at random, roll it, and get a 6. What is the probability that I rolled each die? 
We need to first define the hypothesis(H) ie our prediction of which die has been rolled. In this case the hypothesis has to be a number from the list 4,6,8,12 and 20.
Also the data or observation(D) we are given is that the first random roll resulted in a value of 6.  We have to find the posterior probability distribution P(H|D=6) ie probability of each outcome H=4, H=6, H=8 etc  given the data D=6. The Bayes' theorem says that P(A|B) = P(A).P(B|A)/P(B). in our case P(H|D=6) = P(H). P(D=6|H)/P(D=6).
Now P(D=6|H) is going to be a distribution like
Hypothesis(H) Probability
P(D=6|H=4) 0.0
P(D=6|H=6) 1/6 = 0.1667
P(D=6|H=8) 1/8 = 0.125
P(D=6|H=12) 1/12 = 0.0833
P(D=6|H=20) 1/20 = 0.05
As you can clearly make out the values do not sum to 1. So add all these values and divide each value by the sum (normalize). This is needed to make it a probability distribution. so final result table will be,
Hypothesis(H) Probability
P(h=4|D=6) 0.0
P(H=6|D=6) 0.392156862745
P(H=8|D=6) 0.294117647059
P(H=12|D=6) 0.196078431373
P(H=20|D=6) 0.117647058824
This is called (after normalizing) the Likelihood ie likelihood of getting a 6 on a roll for each die. It is obvious that if we roll a 4-sided die getting a 6 is impossible. Hence likelihood of this happening is 0.0.
The main strength of this book is all problems are solved computationally. The author gives programs for all these and that too in Python. Now if we get more data by going on picking a die at random and rolling the probabilities will change.

Monday, August 13, 2012

Chandrshekhar Azad: The lion who made the British tremble

The true name of Chandrashekhar Azad was Chandrashekhar Tiwari. Born in a brahmin family his mother wanted him to become a sanskrit scholar. But he was a warrior by birth and was interested in warfare. So he learnt archery from the tribals in his village and this helped him in using pistols later on. The massacre at Jallianwala Bagh lit fire in his heart and at the age of 15 he participated in the Non-cooperation movement of Gandhi. Arrested for doing so he was produced before the court where he got his name "Azad". The story goes
The Judge asked his name. He replied "Azad". Judge asked his father's name. He replied "Swaatantra" (freedom). The judge asked where he stayed. He replied "Jailkhana"(ie jail). The judge had lost his temper. He sentenced him to 15 days of rigourous imprisonment. The Azad said "I said all this because i knew you would send me to jail". Everyone laughed at this and judge lost his temper further. He sentenced him to 15 lashes. With each lash he said "Bharat Mata Ki Jai". After this incident he decided that getting thrashed like this would not fetch freedom He pledged that he would never get caught again and preserved this pledge throughout.

Azad joined Ram Prasad Bismil's HRA(Hindustan Republican Association) and participated in the famous Kakori train robbery where they looted money and arms from the train. Azad was never caught but many of his friends were executed later. Azad hid in the jungles near jhansi as acting as a saint and teaching people of the village. He was a popular figure in the village. He hatched the plot to slay J P Saunders after the killing of Lala Lajpat Rai. He tried his best to free Bhagat Singh and his friends and lost his life during such an attempt.

He met Nehru in 1931 and persuaded him to fight the case of Bhagat Singh. But Nehru refused. After this meeting he went to Alfred Park with some of his close friends to discuss but one of his  had turned as an informer and had informed the Police about his location. Bishweshwar singh and Nott Bower led the attack on Azad following the standard british way of firing from behind. But Azad noticed Bower pointed gun at him and showing his sharp shooting skills shot Bower on his wrist and Singh in his mouth(Singh was abusing Azad) and hid behind a huge tree. Alfred Park was surrounded by policemen. Nearly 40 vans of Police had been called. In the firing that ensued Azad killed 3 policemen and injured scores of them though hit in the thigh by a bullet. He gave cover fire to his friend Sukhdev Raj and helped him escape. When he had just one bullet left he fired it into his head keeping his pledge of not being captured. The police did not come near him for a long time fearing he might get up. Such was the fear he had instilled in them. Long live the memory of our heroes. Vande Mataram

Sunday, August 12, 2012

Remembering our forgotten heroes!!


With the 65th independence day nearing it is now time to write a post on 3 of the revolutionary freedom fighters india produced in the last century. I am talking about Chandrashekhar Azad, Veer Savarkar and Madanlal Dhingra. This post will give a glimpse of this lesser known daredevil Madan Lal Dhingra and the other two will be talked about in the following posts.
Madan Lal Dhingra was a born patriot. He got sacked from his college in Lahore for protesting against the Principal's order to wear uniform stitched from English cloth. He got sacked from his job for trying to organize a union (he had a job under British). He made contact with Abhinav Bharat founded by Savarkar and managed to get a seat at University College, London. In London he trained under Savarkar. Abhinav Bharat Mandal mandal was trying to prepare a bomb on its own and dhingra played a crucial role here. One interesting instance:
The members were boiling a chemical for preparing bomb late night and all fell asleep. The chemical was on the verge of bursting out when a member got up to extinguish the flames. But what he saw was a miracle. Dhingra was holding the vessel which was more than 300 degrees hot with his bare hands and coolly placed it on the floor. The skin of his fingers was charred and blood was oozing out but he was calm as if nothing had happened.
The is one more such instance in his life:
Once there was a meeting to talk about the bravery of japanese in the war against the british. Dhingra was annoyed and said that Indians were brave too. All the people made jokes about him. Then ensued a verbal duel btw those people and dhingra. After some time a man poked dhingra's arm with a big needle saying "Let me see how brave indians are". Dhingra was unmoved. He stood still while the needle pierced its way through his hand. Such was his love for this country.

Dhingra assasinated Sir Curzon Wyllie who was then termed as the old unrepenting foe of india. Dhingra fired at Curzon with a revolver when he had attended a function organized by National Indian Association in London. He was later sentenced to death in London. Below are some excerpts from his words during and after trial:

"I do not want to say anything in defence of myself, but simply to prove the justice of my deed. As for myself, no English law court has got any authority to arrest and detain me in prison, or pass sentence of death on me. That is the reason I did not have any counsel to defend me."

"And I maintain that if it is patriotic in an Englishman to fight against the Germans if they were to occupy this country, it is much more justifiable and patriotic in my case to fight against the English. I hold the English people responsible for the murder of 80 millions of Indian people in the last fifty years, and they are also responsible for taking away ₤100, 000, 000 every year from India to this country."

Gandhi criticized Dhingra for his act. He said:
"It is being said in defence of Sir Curzon Wyllie’s assassination that...just as the British would kill every German if Germany invaded Britain, so too it is the right of any Indian to kill any Englishman.... The analogy...is fallacious. If the Germans were to invade Britain, the British would kill only the invaders. They would not kill every German whom they met.... They would not kill an unsuspecting German, or Germans who are guests. "

This statement shows the low logical skills of our Father of the Nation. If German's invade Britain the British cannot obviously ask everyone whether he s an invader or not before killing. Moreover Curzon had been deemed as a foe of india long before this incident.
And amazingly Dhingra got support from the British:
Talking about Dhingra Churchill said (Taken from Wikipedia):
 Churchill said that there has been much discussion in the Cabinet about him. Lloyd George had expressed to him his highest admiration of Dhingra's attitude as a patriot, in which he shared…He will be remembered two thousand years hence, as we remember Regulus and Caractacus and Plutarch's heroes and Churchill quoted with admiration Dhingra's last words, as the finest, ever made in the name of patriotism…"


Dhingra's Last Words:
"I believe that a nation held down by foreign bayonets is in a perpetual state of war. Since open battle is rendered impossible to a disarmed race, I attacked by surprise. Since guns were denied to me I drew forth my pistol and fired. Poor in wealth and intellect, a son like myself has nothing else to offer to the mother but his own blood. And so I have sacrificed the same on her altar. The only lesson required in India at present is to learn how to die, and the only way to teach it is by dying ourselves. My only prayer to God is that I may be re-born of the same mother and I may re-die in the same sacred cause till the cause is successful. Vande Mataram!"







Tuesday, July 24, 2012

Education!! What is it exactly?

A question in this year's NET paper and our Govt's Sarva Shiksha Abhiyaan Ad is the inspiration for this post.
This ad which keeps getting some screen space among other commercials every now and then goes this way - A small girl is walking towards school and saying that from today she wont go to fields with her parents but will go to school. The same ad in newspapers asks parents not to send children to work but to school to get "educated". So what exactly is this "education"?

The first quote from Swami Vivekananda which i had read when i was a boy was "Education is the manifestation of knowledge already in man". I could'nt really comprehend this one then, but after so many years i now know that it deserves a deep analysis. So the purpose of education is to bring out the hidden talents in students. But sadly, thanks to the British, we are sending our children to schools which have become more of marks-fetching machine manufacturing units. We can't really blame the schools though. The mother of a school-going boy in our neighbourhood had come to our house. That boy had never gone for tuitions. But had started going recently. Hence he had no time to play. I asked his mother what was the reason. She replied that the maths teacher wants the answers to be written in the same format(method etc) as she taught in her tuitions! I was annoyed at this. This was murder of maths. But this is what is happening everywhere. We don't find children playing anymore. They don't participate in sports as their studies may be affected. The teachers on the other hand are pressurized from the management to show good results so that they can show to their regulating body that they are performing well!! Same is the state with colleges. Our schools and colleges are now producing citizens who are excellent at cheating others, the nation and themselves. They are trained from childhood to SOMEHOW get marks. This gets extended to their jobs once they grow up.

The vicious circle: Nowadays almost all schools and colleges are run by rich politicians or businessmen through trusts. And we have bodies such as AICTE to look into the quality of education being imparted . We also have accreditions such as NBA which schools and colleges strive to get because that will help them fetch grants and  funds. The university demands that colleges show some minimum pass percentage otherwise the college/school will be questioned. Thus the teachers have to make sure their students score well leading to decline in the quality of education.

 So, education is not about scoring marks and getting a degree. It is about becoming human. It is about gaining knowledge and using it for the betterment of all. It is about producing good responsible citizens. A person who works in his field sincerely is an educated person. A person who sweeps the locality sincerely each day is more educated that the rich guy who shamelessly wastes water on his compound and cars each day. We need to shun this British-infected mentality that a person who learns english is educated. All arts need to be respected. A person who lifts garbage sincerely is not uneducated but an employee who shamelessly draws salary each month without doing any productive work is uneducated.
That which makes rich is not education but that which makes us love and respect everything around us is. Let us become truly educated!

Wednesday, July 11, 2012

romance, love fight and discrete mathematics!!!!

This is an interesting idea which flashed in my mind on my to Dharwad from Hubli. Sitting on my bike for a pretty long time i suddenly got the thought of a common Hindi film sequence. With it a question and then an amazing romantic answer! So here it is:
The hero is a Pokiri or a Rowdy. But a good person by heart. He keeps teasing a girl(heroine) every now and then. This girl too develops a soft corner for the hero but is reluctant to express it. Now one fine day the hero asks the heroine for a date. She refuses(obviously). This guy being a rowdy gets annoyed and puts a condition. "If you dont come with me for dinner tonight, I will kiss you now in front of everyone!". The heroine is shocked. It is obviously better to have dinner with this maniac than get kissed in public. Moreover he is a rowdy. So he can do anything. So she agrees to go for dinner with him. Now comes the twist in the tail. This guy then kisses her in public. She is really annoyed now. She then accuses him of going back on his word. The hero now begs her to forgive him. The hero starts singing a song to pacify her etc etc etc.  Now the question here is was this begging really necessary? Did he really go back on his word ie did he break his promise?

Now enters the amazing branch of logic. Let 'p' be the statement "you come for dinner tonight" and 'q' be the statement "I will kiss you in front of everyone". So now his statement can be represented as :
 ~p -> q.  (~p here is the statement "you do not come for dinner tonight"). If he had really gone back on his word then this implication should have been false. But an implication a -> b is false only when 'a' is true and 'b' is false. I wont explain why this is the case here because that would need a separate post. Now since this implication is true for all remaining 3 cases ie TT, FF, FT and the hero has kissed this heroine making 'q' True his statement is True and not false. Thus he has not gone back on his word and does not need to pacify her at all!!!!!!!!!!

Sunday, July 8, 2012

How the British conquered us and why we got independece

Being an Indian my blood boils whenever I think about the British. But then I started thinking in the other direction. Should we hate them for ruling us? This question which kept cropping up now and then in my mind has led to this post. After a lot of contemplation I have come to the conclusion that the British didn't really betray us. It is we who betrayed ourselves and continue to do that. The British came to India as businessmen. They came here to make money. And they did what any clever businessman would ve done. The Westerners knew that India had plenty of wealth. But they probably never happened to stay here long enough to decide on the psychology of Indians. It took them many centuries to convert the satisfied souls here into dissatisfied ones. The muslim invaders never had a strategy when they invaded india. Their intention was to spread Islam and for that they needed a kingdom. Though they succeeded to some extent they never managed to conquer us completely because the people were still ideological. They still believed in the concept of good and bad. The British knew that the main hurdle to looting this country was this belief. They knew that once the people get isolated from their ideology they can be purchased. So they started out by making people believe that a person in Western outfits is respected. They gave respect to people in Western outfits. They called such a person "gentleman". It was not difficult for them to buy a few indians to wear their outfits and sport them in front of their family and friends. But they didn't stop there. Hindus were in majority then. But many were poor too. Any poor person gets the feeling that God is not helping him out of poverty. So the British gave these people money and told them false stories that they will become rich if they follow Chritianity. They gave them jobs in their army etc. So now they slowly started getting people to follow them. But still their intensions were not met. The self belief and patriotism of indians had to be suppressed. So they decided to bring in a new education system. THEIR education system. It consisted of teaching children THEIR language, THEIR ideologies. To make this popular they used media. They  made people feel that only those who take up their education  are truly educated. To support this claim they gave jobs for students. Thus now these people who had taken up jobs in British raj started lowly treatment of others. The British chose brahmins for this as brahmins then were primarily the custodians of sanatan dharma. With the root poisoned it was now very easy to start looting. It is very well known that they used divide-and-conquer strategy to take hold of india. Surprisingly the majority of soldiers in the British army were indians. The british had many selfish Kings under their control and these kings had let their soldiers to serve the british.

The British finally left India in 1947. Not because they were tired of Gandhi and Congress. But because they knew that there was nothing left to loot here. Moreover they knew that they had enslaved almost every Indian knowingly or unknowingly. Indians then were greedy to make money. They had become cowards unwilling to fight thanks to the ahimsa preached by gandhi. What more, they were happy that most Indians had no self identity. Now being born from these Indians how can we possess any self morale? How can we be patriotic? That is the reason behind corruption. That is the reason behind all our woes. Let us shun the money-based education system introduced by the British to enslave us and produce only accountants. Let us get back to our roots. Let us become truly independent!!

Friday, May 18, 2012

Varna vs Jaati: An analysis

This post is again inspired from Sri Bannanje Govindacharya's discourse on Bhagwadgita.
One of the reasons Arjun gives for not fighting the battle is the fear of Varnasankara. ie mixing of varnas. What this means is, if a war happens many young men will die leaving behind their young wives or sisters. And then these women are most likely to be raped/murdered or used by rogue men. Thus women from different "varnas" may be raped by men from different "varnas" and hence the offspring born is going to be "mixed'.

This has probably been one of the most contentious verses in the BG. As if to add fuel to fire, Krishna later on says that he is the creator of varnas! So what IS a varna? Is it same as caste ie jaati? This question had be plaguing me since a long time. I never got satisfactory answers from pundits who are on  most occasions reluctant to talk on this. Most of the traditional pundits prefer to say that caste=varna. But we cant just say this because there are many examples inter-caste marriages in our shastras. After listening to Sri Bannanje's lecture i am convinced to some extent about what this actually is and hence i ll share that with you people.

Varna in sanskrit stands for many things. One popular meaning is COLOUR. So what does mixing of varnas mean? Mixing of colors? Neah..that s foolish you may say. But Sri Bannanje gives a wonderful example here.
We use sentences like "Now he has shown his TRUE COLOR", or in kannada "Avana Banna Bayalayitu". So what is the meaning of color here? It means nature. Inherent nature. Every soul has its own inherent nature as per Madhwa philosophy. This nature itself is varna. So what does Krishna mean when he says "I created the varnas"? He means that he classified the souls according to their nature into 4 categories and gave each category a name (Brahmana, kshatriya, vaishya and shudra). A soul which belongs to a brahmana(category) is rich in wisdom. Likes to read, write and teach. Follows rituals, is godly etc. A kshatriya soul is inherently a leader. Interested more in ruling the world, strong  and is courageous. A vaishya soul is interested in business, agriculture etc. A shudra soul is interested more in serving others, working under someone etc. For any system to work properly all these 4 categories are necessary.
Then what is jaati. It is that which comes by birth, ie with the body. So if a person is born and brought up in a orthodox brahmin family he is more likely to religious. Same holds elsewhere. So what is "varnasankara" or mixing of varnas? It means mixing of people with opposite nature. for eg. A person who is interested in studies will get tortured if asked to do business. So if a brahmin soul is born in a brahmin caste ie a family in which there is religious he will be more happy than if born in a family of politicians.

Thus caste or jaati comes by birth (created by us) and varna is inherent to the soul. This understanding is able to solve many of the common questions that arise in our scriptures. Any suggestions will be entertained!