Monday, 7 July 2008

Great Generals: Hannibal takes on Rome - I , Battle of Trebia

I want to start the series of posts on great battles and generals with three battles of Hannibal of Carthage. Hannibal was one of the greatest generals in History and some even call him the 'Father of Strategy'. His greatest achievement was when he led his army across the Pyrenees and the Alps and attacked and defeated Roman armies multiple times at home. And if this was not enough of an achievement, he did it all using a massively under-matched and eclectic army formed with soldiers of different cultures and nationalities. He defeated Roman armies in a series of battles that are still considered to be strategic masterpieces. Students of military strategy all over the world still learn about Hannibal and his battle tactics.

His impact on minds of future generations was so great that Napoleon (another contender for the title of 'Greatest General in History') said that he learnt from him, and General George Patton of the US army during World War II, thought of himself as a re-incarnation of Hannibal. When German military commanders wanted to come up with a plan to invade France in early 1900 (before WWI), they came up with a large scale re-enactment of Hannibal's Battle of Cannae, also known as the Schlieffen Plan. They tried a version of the plan in the initial stages of WW1, but couldn't pull it off. Later, Hitler's generals also used a version of this plan when planning an attack on France again in WW2, but this time succeeding.

But before we get to the Battle of Cannae, I want to talk about Hannibal and his march into Italy. When he came into Italy after crossing the Alps he defeated Roman armies in two impressive battles at Trebia and Trasimene. These two battles lay the groundwork for Cannae. We will start with them...


Hannibal and his march into Italy

Hannibal was born in Carthage as the son of Hamilcar Barca, a powerful general and statesman. Carthage was a city state in North Africa on the coast of the Mediterranean, in present-day Tunisia. Carthage used to have control over Sicily and Sardinia, but when Rome took them in 3rd century BC, a war broke out between Carthage and Rome called the First Punic War. After distinguishing himself in the First Punic War, Hamilcar Barca rose to become a powerful general in Carthage. Legend has it that when fighting the Romans in Spain (called Iberia then), he founded a town called Barcino which has now become Barcelona.

His father taught Hannibal how to fight and command armies as well as to hate Romans. Legend has it that he made his son swear on his death bed, that Hannibal will fight the Romans to his death. After his father died, Hannibal took charge of the Carthagian forces and attacked the coastal Spanish town of Saguntum in 219BC after the previous treaty with Rome fell through. The siege of Sagantum was hard for Hannibal and it took eight months. After this experience Hannibal was always vary of laying sieges to cities. This could be one of the reasons he didn't lay siege to the city of Rome directly when he was in Italy.



Hannibal was now determined to take the fight right to the Romans inside their own country. He had greatly admired Pyrrhus, a great Greek military leader who attacked Italy (and whose name dons the phrase 'Pyrrhic Victory'), and he was convinced that it was possible to fight Rome inside Italy. He decided to invade Roman territories of Iberia (Spain) and Gaul (France).

Hannibal took 50,000 infantry, 9,000 cavalry and 37 war elephants with him to cross the Pyrenees and Alps to attack Italy from the North. Even the thought of such a feat had never crossed anyone before, but here was Hannibal who was determined to do it. After braving harsh weather, ambushes from local tribes, problems with food, water and shelter, Hannibal was able to make it to the plains of Northern Italy. Only 38,000 infantry, 8,000 cavalry and 30 elephants could make it through the journey.

On reaching the other side, the first thing Hannibal did was make some treaties with the chiefs of the local Gallic tribes, before Rome had a chance to talk to them. He got a lot of them to join his army and thus bolstered his army back to 40,000.

Battle of Trebia

When Publius Cornelius Scipio, the Roman General who was sent to track and fight Hannibal in Spain, found out that Hannibal was crossing over the Alps to Italy, he hurried his army though the sea route to Italy to stop him. In a small confrontation at Ticinus, his army was defeated and he got severely injured.

When the Roman Senate heard of this, they sent Sempronius Longus, a consul (there used to be two consuls in the ancient Roman republic who ruled the country - chosen by the senate) to fight Hannibal and give support to Scipio. But, Sempronius had his own agenda. The consul elections were coming up, and he wanted all the credit of defeating Hannibal for himself. He wanted to defeat Hannibal before Scipio and his army could recover so that he would look good in the eyes of the Senate back home. As you can figure, he was an arrogant and an impetuous man.

Unfortunately for Sempronius, Hannibal knew of his impetuosity and impatience. Gallic spies that Hannibal had sent into the Roman camp were giving him all the information about Sempronius, his camp's location, their strength, their strategy and even rumors about the general Sempronius. Hannibal decided to use this weakness and exploit it by setting up a trap for Sempronius' army. In the cover of the night, he sent his brother Mago along with 1000 light cavalry and 1000 Numidian cavalry to hide amongst the dense trees and cliffs further along the river. In the morning, Hannibal sent his cavalry across the Trebia river to harass the Roman soldiers and then retreat, so that hot-headed Sempronius would follow them and walk right into their trap.



And as Hannibal had expected, Sempronius obliged. When Hannibal's cavalry came to harass him, he first sent all his cavalry after them, and then later sent all his infantry after them too. By the time they had crossed the Trebia river, Roman infantry was cold on the winter morning, hungry(as they had not eaten) and unprepared to fight. Meanwhile, the Carthagian soldiers taken all night to prepare and Hannibal had setup his army formations at a place of his liking.

Head-to-head, Hannibal had a slightly smaller infantry (30,000 compared to Roman 40,000) but a relatively much larger cavalry (10,000 vs 4,000). So, Hannibal's strategy was to break the Roman cavalry flanks (left and right) with his stronger cavalry and then attack their infantry centre.

When the battle began and the two infantry centers were battling it out, Hannibal's cavalry started destroying the Roman cavalry flanks and then turned to their infantry. Hannibal also sent all his war elephants against the Roman allies, the Gallic light cavalry. The allies were so surprised, and afraid after seeing the mighty beasts that they got demoralized and retreated, thus leaving a large portion of the Roman center vulnerable.

And to top it all off, Mago's unit hit the Roman legions from behind in an ambush, and thus giving them no place to run. Surrounded from all sides, cold and hungry, the Roman infantry was cornered, trampled and butchered. Some of the cornered Roman soldiers were able to break the Carthagian line and escape ahead to a nearby town of Placenta. But, in all 20,000 roman soldiers were killed that day (more than one third of the Roman army).

Sempronius was shamed and sacked when he returned to Rome. The Roman Senate appointed two new generals as Consuls: Gnaeus Servilius Geminus and Gaius Flaminius, the second of whom lead the Roman army during the second battle at Lake Trasimene.

Hannibal on the other hand, headed on into Italy.

This marked the first decisive victory for Hannibal in Italy over Rome. But this was just the start for him....


Next up: Battle of Lake Trasimene (or how to lay an even bigger trap)

Image Source: The Department of History, United States Military Academy

Update: Others in the series: Battle of Lake Trasimene, Battle of Cannae

Wednesday, 2 July 2008

Starting the History Series

Starting this week, I will be writing a series of posts about history, about interesting battles, people who fought them and how it affected the way our world, our history and our society developed. I'll start with writing about some important, decisive and 'cool' battles. I know battles and wars are bloody and cause hardships to all involved, but they are also interesting in the sense of how the kings, generals and soldiers tried to to win.

If you put yourself in the position of these people, you'll find that they had many decisions and often many choices. What did they choose to do and what was the outcome? Thats what we will try to analyse...

And maybe, we can learn something in the process...

Here is my potential list:
  • Hannibal and how he defeated Rome
  • Alexander's last battle on the borders of India: Battle of Jhelum (Hydaspes)
  • Napoleon and the Battle of Austerlitz, defeating both the Russian and the Austrian Empires
  • The Second Battle of Panipat, which led to the establishment of Akbar the Great and the Mughal Empire in India
  • and more... (suggestions are welcome)
Hold your breath... :-)

Tuesday, 1 July 2008

Hacker News network of users (based on commenting behaviour)

There has been a lot of discussion lately on trust measures, reputation and groups on Hacker News. So, I decided to run some experiments on the crawled dataset of stories released by Xirium (http://news.ycombinator.com/item?id=182374).

Of course, the real database of voting history of users would have been much better, but this is all I could get...

Calculation

The trust values were calculated as follows:
  1. For each story the submitter gets +1 from all commentors. I know this is naive, but bec. of lack of voting history (on the story), I had to go with this assumption.
  2. Each commentor gets ( votes_on_that_comment / total_votes_on_all_comment ) for each comment on that story, from all other commentors. (Again I know this is naive).
  3. Trust values are added up for (object, subject) pairs across all stories.
  4. The votes on the story were recorded as votes from a virtual user 'HNCROWD' for the submitter. After adding up, the trust value from HNCROWD for a user reflects the 'Karma' of the user on the website.

The resulting file is downloadable in CSV format here (http://www.sendspace.com/file/mw59f7).

So with these values I tried running some experiments:

1. Clustering:

An interesting experiment would be see if there are clusters of users among commentors. I used the Markov Clustering Algorithm (http://micans.org/mcl/) for clustering graphs as it does not need the number of clusters as initial input.

Unsurprisingly enough, most of the Hacker News community belongs to a single cluster. This makes sense as Hacker News is quite a focussed community interested in practical hacking related to the web, entrepreneurship and startups.

Other explainations are that users who comment are themselves quite interested in the stories and the community and are hence closely connected and similar. The users who are dissappointed with the website, might not be commenting at all... Again, using voting statistics would have been better.

2. Trust-Rank:

Second, I tried applying a variation of the TrustRank algorithm ( http://www.vldb.org/conf/2004/RS15P3.PDF ) to the trust values data.

The result here was also unsurprising. The ordering of users was very similar to what is generated using Karma on Hacker News website.

Further work:

1. The method of calculating trust values (based on comments) is very basic and needs to improved (like taking into account threads and opposing opinions).
2. I want to see if this information is actually useful in tasks like News-Story Recommendation.

Conclusions:

Without the availability of voting data, it is hard to say if users on a focussed site like Hacker News have diverging interests. I am sure, as the community grows people of different interests are bound to join. But, the whole idea of a democratic voting site only allows stories that are interesting to the most active users to be selected. And so, other users will find the website boring, and not contribute and maybe leave. This might be an example of a community maintaining itself...

Giving highly trusted users down-modding power will strengthen this emergent behaviour, and the community will become more focussed (towards these users) than it is now. This might be both good and bad depending on if you are in this majority...

P.S. Thanks to Xirium for sharing the dataset.

Monday, 30 June 2008

Quick: email current page using Gmail

Quick post further to my previous post where I shared a quick bookmarklet that allows you to email the current page. Here is a link that allows you to email using your Gmail account:

Gmail »

Again, just drag and drop this link to the bookmarks toolbar in Firefox.

Monday, 14 April 2008

Enjoying History


Recently, I am beginning to get more and more interested in History. I have found that I can spend hours reading Wikipedia and other historical websites. I am even bringing books on history back home from the library (which is a big deal for me)...

But what is most fascinating to me, is that I used to dislike history in high school. I found it so boring back then, that I could hardly read two pages of my history textbook without feeling sleepy. It usually happened like this: I started to read the book on my study table, but started getting sleepy, so I moved to my bed so that I could read comfortably there. Sitting on the bed soon changed into leaning, then reclining, then reading while lying down, and finally putting down the book and actually sleeping. :-)

Back then, history was about dates and a bunch of numbers which didn't mean anything. We had to remember these dates along with some events of the past, that had nothing to do with us. What does the story of some random king, in an unknown country in a remote part of the world (that I will probably never visit in my life), have to do with me? Who cares if people fought with swords or bows and arrows, or if they thought fighting on horseback was the cutting edge in military technology... It had nothing to do with me...

What changed? Am I reading a different history now from what I was reading back then? Maybe. But mainly, I think what changed was the way I looked at History. And the seed was planted by something that my father said to me long ago.

We were chatting about political history once, and I remarked how same things happen again and again. I said the history of the world is like a cycle. For eg. when rulers abuse their Dictatorial or Authoritarian rule, it always leads to revolt by the people and some form of Democracy is adopted. This has happened in ancient Greece, Rome, France and America (during revolutions), and freedom movements in many former colonies like India. But soon, democracy gets corrupted, where criminals,
the rich and powerful and those who know how to manipulate the common people, rule. They don't allow capable and honest people to rise. Democracy then becomes an impediment, rather than a savior of the people. When this happens, usually a person with will and ambition emerges and starts fighting against the status quo. He takes the power in his hands, and then passes his judgment onto the society that is struggling to save itself. Julius Caesar, Napoleon, Hitler and Mao Tse Tung and examples of such people. Their personal beliefs may be different, but they all represent the same will to gain power. After a while, this absolute power corrupts (as Lord Acton famously said) and again leads to Authoritarian rule that exploits people. So, is this a cycle that is deemed to repeat again and again?

My father asked me to take a closer look. He said that history is not exactly a cycle but a spiral. Things that happen in the past, affect those that happen in the future. Knowing past events affects the minds and the judgment of people making decisions in the present (even if to a small degree). So, even if flow of events looks similar on a large scale, they are actually different. So, to prevent the same things happening, we must understand history, and learn from it. But how do we understand history?

To truly understand history, and why people behaved the way they did, we have to get into the minds of these actors. What did these people see in the world around them? What were their choices? What was it that motivated them, and what was it that they lived for? What were the forces acting on them, and circumstances which they had to face?

When we start imagining history as something alive, as something that we can see and be part of, it suddenly becomes a whole lot exciting. We can be almost sure, that someone somewhere was faced with decisions similar to what we are faced with today. What did he/she choose, and why? What were the consequences? Were they in control of their destinies, or were they just pawns in the overall scheme of the world?

Imagine yourself in history, and history will tell you amazing things. It will tell you
great stories of extraordinary people in ordinary circumstances, and also great stories of ordinary people in extraordinary circumstances. History is a chronicle of how people just like us lived, how they fought against a hostile world, how they molded their destinies, and how they died. Were they able to achieve anything? Were they happy in the end?

In the end, it is all so that we can answer our own questions... Will we be able to achieve anything? Will we be able to make the right decisions? How will others in the future look at our lives? What will our history be like?

Saturday, 12 April 2008

Invention of Zero and Brahmagupta

I just found out that Zero was invented very close to my home town...

BrahmaGupta who was a great mathematician from Ujjain, an ancient city (est. 6th Century BC) about 40 miles from my hometown Indore (there was no Indore then). This is circa 600 AD.

Arabic scholars adopted Zero and its mathematics from texts written by Brahmagupta (mainly 'Brahma-sphuta-siddhanta' or the 'Corrected Treatise of Brahma'), and was later passed onto Europe through them. The Sanskrit word ‘Shunya’ meaning nothing, empty or void, became ‘Siphar’ (origin of the word Cipher) in Arabic, which became Italian ‘Zephiro’ and hence ‘Zero’ in French and English.

Brahmabupta provided all the rules for adding, subtracting, multiplying and dividing positive and negative numbers. But he made one mistake: he said 0/0=0, which is wrong. As there was no concept of ‘limits’ and differentiation at that time (at least for Brahmagupta), he did not consider that
lim(x->0) x/x = 1. Though even now, mathematicians are unsure about what the value of 0/0 should be. In modern day computer programming languages, it is refered to as NaN or ‘Not A Number’, and dividing by zero is prohibited.

On Astronomy, Brahmagupta argued that the Earth was round and not flat, a point on which he was ridiculed by many Islamic scholars who read his work later.


Aryabhatta

Before Brahmagupta, around 500 AD, another Indian mathematician and astronomer Aryabhatta had said that
"Sthanam sthanam dasa gunam"
or 'place to place in ten times in value'. This might actually be the origin of our modern decimal-based place value notation!

Aryabhatta also influenced the birth of Trigonometry, and he was the first to describe sine's and cosine's, and prepared tables for them.

As with 'zero', the words 'sine' and 'cosine' are derived from what Aryabhatta called them: 'jiya' and 'kojiya'. Arabic scholars called it 'jiba' and 'kojiba'. They were then misinterpreted by Gerard of Cremona while translating an Arabic geometry text to Latin; he took 'jiba' to be the Arabic word 'jaib', which means "fold in a garment", and translated it into L. sinus.

Following Aryabhatta, another mathematician from Ujjain, Varahamira worked on Trigonometry in-depth. He is attributed with first developing basic rules like:
  • sin(x) = cos(/2 - x)
  • sin2(x) + cos2(x) = 1

But, even though Mathematics and Science were quite advanced in India at the time, this progress suddenly ground to a halt after 10th and 11th Centuries. This may be because India was under constant threat of attack from the North and West from descendants of Mongol warlords, and Islamic invaders. With the exception of Akbar, most Muslim rulers of India, favored Persian and Arabic knowledge and culture over traditional ancient Indian knowledge. Hence, such astronomers and mathematicians lost the patronage they used to get during the Gupta kings in the first millenium.

The Gupta period (between 300AD and 600AD) is considered as the 'Golden Age' for Indian science and mathematics. Kings like the legendary Chandragupta Vikramaditya were great patrons of science and art.

Research has always been heavily dependent on state support. Even now, the universities that get most government research grants are also the best in the world. See the earlier post on how Stanford University and the Silicon Valley prospered because of the funding they got for defense projects.

The Wikipedia entry on the history of zero is a good read.

BBC Radio 4 also covered the history of Zero here.

Tuesday, 1 April 2008

Emailing the link of the current page

Remember the times when you want to send an interesting link or URL to a friend, but the only way is Copying the URL from the browser's toolbar and then Pasting it into your email application. It is frustratingly tedious...

So, here is a link that opens the default email app and copies the URL of the current page to the email. We only need to Drag and Drop this link to the browser toolbar, and then use this as a button:

Email »

We can then edit the email and send the message...

Edit: Apparently 'dragging and dropping' works in Firefox but not in IE. In IE7, the link can be added as a Favorite into the 'Links' folder. It then appears in the Links Toolbar. When clicking on the page it does change the page, but we can go back using the 'Back' link. I suddenly like FF even more... :)