Tuesday, May 21, 2013

Tinker Tailor Soldier Spy

Movie Review : Tinker Tailor Soldier Spy
Genre : Thriller / Suspense
Director : Tomas Alfredson
Starring : Gary Oldman, Colin Firth, Tom Hardy, John Hurt
Released : 2011
My Rating : 8 out of 10

David Cornwell worked in the UK Secret Service in the 50 and 60s. Drawing from his experience with MI5 and MI6, he wrote psychological thrillers that portray the world and life of spies as realistically as possible. His novels are unlike anything you will ever find in James Bond movies/novels. They are also unlike anything Ludlum ever wrote in his many end-of-the-world conspiracy novels or his celebrated Jason Bourne series. When his spy novels started becoming international bestsellers, Cornwell chose to become a full time author. The novels written using his pen name - John Le Carre - have defined the standard by which all spy novels are measured.

These novels are devoid of physical action and packed with mental tension. Leisurely paced and full of jargon, they require complete attention from the readers to follow the chess games that are being played in the minds of spymasters. It's well worth the effort. But keep this point in mind when you watch this adaptation of what's often considered as John Le Carre's finest novel.

George Smiley (Gary Oldman) is the central character here as in many of Le Carre's novels. An operation goes terribly wrong and he is forced out of service, along with his boss - known to us as "Control" (John Hurt). When a British undersecretary receives a tip that there is a double agent very high up in the organization, he asks Smiley to head a secretive investigation, outside the scope of the "circus" or MI6. This is the story of that investigation. It's also the beginning of the trilogy that pitted Smiley against the head of KGB, referred as "Karla".

It's a complex book, with a large number of characters, and many subplots that don't lend to the 2 hours movie format. There was a very popular BBC serial with none other than Alex Guinness starring as Smiley. A TV serial is the right format for so much material. Making a movie out of this book is a daunting task. Director Tomas Alfredson succeeds in maintaining the atmosphere, the tension - but fails in clarifying everything that goes on. I felt a bit confused at multiple junctions in the movie, and I am sure I am not alone.

It's just the nature of this particular book that makes it so hard for the director and the writer. Le Carre's other novels have been successfully adapted. I really like "Tailor From Panama", and I highly recommend it. I was less impressed by "Constant Gardener", even though it earned many nominations and Academy award for Rachel Weiss.

Gary Oldman was nominated for Oscar for his performance as George Smiley. No disagreements there. I haven't seen Alex Guinness play this role in the TV serial, so I cannot compare. I am sure it's hard to top Sir Guinness, but Oldman was fantastic for me here. The entire cast is filled with A-list actors. John Hurt, Colin Firth and everyone else gives a perfect performance.

The director has to be complimented for remaining faithful to the book in the style of presentation. This movie uses camera far more than words. There are many silent scenes and they are potent. When "Control" and Smiley are dismissed from the service, they say a silent goodbye to each other. That short scene conveys so much. You immediately know that they were close allies, but it's all over now, and there is nothing left to say.

I recommend this movie to anyone who is in a mood for a satisfying experience and willing to work the little grey cells. With many jumps back and forth using flashbacks, the structure of the movie doesn't make it simpler. A few scenes make it unsuitable for kids, but even otherwise, I don't suspect kids of any age to have the attention span required to enjoy this movie.

Wednesday, May 15, 2013

Integer Partitions

Integer Partitioning is a standard problem that arises in many situations. If math is what you do, then perhaps you would classify this as a simple problem. For the rest of us, it's far from straightforward.

The basic problem can be stated as follows.

For any given positive integer N, in how many different ways can it be partitioned, that is, written as sum of smaller positive integers ?

Let's define the function P(N) as the number of integer partitions of N.

For example, 4 can be written in 5 different ways (partitions)
1 + 1 + 1 + 1
1 + 1 + 2
1 + 3
2 + 2
4

So P(4) = 5.

Note that
1. Order of integers does not matter. So 1 + 4 is considered as the same partition as 4 + 1.
2. An integer can appear multiple times in a partition.

As is often the case, if you don't already know the trick, it's not easy to figure it out. For example, the first thing I tried was using induction, as in, can P(N+1) be expressed in terms of P(N)? I couldn't find any easy way to express it. Maybe there isn't a natural way.

The common trick in solving combinatorics problems is to use the principle of mutual exclusion. But how do I break the problem down to mutually exclusive smaller problems ? I couldn't find a way, so I gave up and surrendered myself to the all-knowing Wikipedia. Sure enough, the answer is there and this time the trick is to use an intermediate function.

Well that gave me the formula, but the explanation wasn't lucid enough on the Wikipedia page. So I decided to try to explain it in much simpler way.

It's a very nice trick and worth writing about.

Let's define another function - I am calling it partial partitions - PP(N,k) as the number of integer partitions, in which the smallest addend is at least k. It's important to note the language. The smallest addend doesn't have to be k, it can be more than k. In other words, no addend can be less than k.

For PP(4,2) we have 2 partitions in which every addend is equal or greater than 2
2 + 2
4
So PP(4,2) = 2.

For PP(4,3) and PP(4,4) we have just one same partition
4
So PP(4,4) = PP(4,3) = 1

Now, note that P(N) = PP(N,1). So if we can find a formula for PP(N,k), we will be able to determine P(N).

This neat trick of considering a more general problem, allows us to use the divide and conquer strategy. Now PP(N,k) can be divided into categories.

1. Where the smallest addend is exactly k. Let's call it PP(N,=k)
2. Where the smallest addend is strictly greater than k. Let's call it PP(N,>k).

It's easy to see that the second category is same as PP(N,k+1) because every addend must be strictly greater than k, so it's at least k+1.

What about the first category ? In this, every partition has to have k as an addend. There may be more than one addend equal to k. Since every partition has k, if we remove it, then we get partitions for N-k, and each of this partition satisfies the condition that no addend is less than k. This is PP(N-k,k). A diagram might help visualize this.


We must make sure that it is indeed the case that PP(N,=k) = PP(N-k,k) for all values of 1 <= k <= N for all integers N.

Consider a partition in PP(N,=k). As we have noticed already, removing the addend k, leaves us with a partition that adds up to N-k, with every addend >= k. Since we removed the same addend k, and every partition was different no two remaining partitions can be same. So we get proper set of distinct partitions. So PP(N,=k) must be a subset of PP(N-k,k).

Now let’s try from the other side. Consider PP(N-k,k). If we add the addend k to every partition, each partition will add up to N. Since we added the same term to each partition, they still remain distinct, so we have a proper set. Also, since we added the addend k to it, every partition of course has an element that's exactly k. So this PP(N-k, k) must be a subset of PP(N,=k).

Since PP(N-k,k) and PP(N,=k) are subsets of each other, they must be equal.

Combining all this together

PP(N,k) = PP(N,>k) + PP(N,=k) because of mutual exclusion
PP(N,k) = PP(N,k+1) + PP(N-k,k) as explained above

Now this is a recursive formula, so we need terminating conditions

PP(N,k) = 0 if k > N
PP(N,k) = 1 if k = N


To wrap up,

P(N) = PP(N,1) = PP(N-1, 1) + PP(N, 2)
That’s one pretty looking formula. In such recursive formulas, like partial derangement, both the terms reduce N and k to terminate the recursion. Here, one term reduces N, while other increases k. That’s got to put a smile on your face if you like recursion!

Wednesday, May 8, 2013

I told you so

Randy Travis is now an elderly figure in Country music. He enjoyed great success in late 80s, and left a permanent mark with his traditionalist approach. His songs from that period define country music to me. Simple music, touching words, great voice and sung with pathos.

The song "I told you so" is one of his biggest hits, reaching the top of the charts in 1988. The lyrics are a bit too cheesy, but it's still one of my favourite songs for his well controlled delivery. The melody is just wonderful.
Would you tell me that you've missed me too, and that you've been so lonely
And you've waited for the day that I returned
And we'd live and love forever, and that I'm your one and only
Or would you say the tables finally turned

Would you say I told you so, Oh, I told you so
I told you someday you'd come crawling back and asking me to take you in
I told you so, But you had to go
Now I found somebody new and you will never break my heart in two again
This is original solo from Randy Travis.


The song was later covered by Carrie Underwood. Her duet version with Randy Travis made the song a huge hit once again, more than 20 years after the original version.

This is a live performance at the American Idol show. The tonal qualities of the two singers provide an interesting contrast. Of course, Randy Travis sounds aged and anyway it's hard to keep up with the range of pitch in Carrie Underwood's voice.

Thursday, May 2, 2013

Ladybug

Ladybugs are cute, maybe the best looking insect after a butterfly. They do more than inspiring attractive toys for babies. They are a friend of a gardener. Especially when it comes to roses. Because they prey on aphids. Aphids are those small tiny creatures who invade a tender rose shoot in hundreds. So the ladybugs serve as a natural defense against these horrible little aphids.

I was lucky to capture this on camera. I got a few great shots of the ladybug and one absolute prize shot of it attacking the aphid.

You can click on any photo to start a slideshow and view the photos in large size.

All the photos were taken with my Canon T3i, and at f/1.8 with a 50mm prime Canon lens.

I was holding the branch, twisting it, turning it so that I can have the ladybug in the front. It took me a long time, and a few cuts on the arm from thorns, but it was totally worth it.


Next, the predator on the prowl.


The search is still on. You can see the aphid on the branch above.


Still looking.


Found it!


Thank you Madam, for finishing up those little rascals, as well as posing for the camera.


Related Posts Plugin for WordPress, Blogger...