Friday, November 30, 2012

The Miracle of Freedom



Book Review : The Miracle of Freedom
Authors : Chris Stewart, Ted Stewart
My Rating : 3 out of 5

The complete title of the book is "The Miracle of Freedom : Seven Tipping Points That Saved the World"

Do you think that we are extremely lucky to be born in these times ? I do. My understanding of History suggests that, common people on an average have never lived a better life. In many parts of the world, people have the freedom to self-govern. It's not a perfect world, there is hunger and oppression in many countries, but remember, just a couple of centuries ago, democracy was virtually unknown to the most of the planet. Even in Western Countries with established democracies, suffrage became universal only in last 150 years or so.

All throughout history, almost everywhere in the world, lives of commoners had been considered near meaningless by whatever form of regime that existed. Wars and destruction have been all too frequent. The chance of being born to slavery was always much higher than being born in a privileged family.

Today's democratic system is not a logical outcome of any evolutionary process. It happened by chance. Considering how fragile it is in many societies, it's continuation is not a guarantee either. So how did our species come to this social destination that values individual freedom, and pursuit of happiness for everyone above some vague glory for a king or a religion ?

That is an enormously fascinating subject that the authors Chris Stewart (Republican Congressman from Utah) and Ted Stewart (Chief Judge of US District Court in Utah) tackle in their book. Or should I say, claim to tackle in this book.

First the good part. Their position about the exceptional state of today's political system is easy to agree with. They have a knack of engaging writing and make this a page-turner. The format of interleaving history, with stories of completely fictional characters works most of the time. Much of the presented history is accurate.

The bad news is plenty. I have no issues with their choice of events. I didn't always agree with the importance they give to a certain event, but it's a subjective choice. The problem is not this choice. The problem is the assertions they make.

If I have to summarize the book's arguments in once sentence, it is this. These key events saved Christianity and Western Europe, hence we have a political system that is based on individual freedom.

That's a bold claim bordering on propaganda. Especially the Christianity part. It's really hard to accept that any organized religion can be given credit for capitalism and freedom of thought. I am always willing to listen to a well-reasoned argument. No such argument came forth in the book. Instead, just a lot of assertions are made. Even for the not-religious aspect, arguments are not strong enough. I don’t think the defeat of Xerxes saved the world. Because I don’t think there is any evidence that the Greek kings were in support for democracy, and by all accounts the Persian Empire founded by Cyrus the Great was famous for its respect for human rights.

Although I am not a religious person, I happen to have a favorable view of most religions. I think a lot of good has come from Christianity or any other religions. I am not making a politically correct statement. I very sincerely think that, even when you subtract all the atrocities committed in the name of the religion, the impact of religion on human happiness is still positive. That's just my viewpoint on this gray area. Nevertheless, I simply cannot accept that capitalism and freedom derived from Christianity.

On the other hand, I do agree somewhat with authors about the positive contributions of the Western Europe to the development of democracy and capitalism. This is another touchy subject for most people. But it is not as gray subject to me. Foundation of most of the "modern" achievements in all forms of human thinking indeed happened in Western Europe. This is not to say, that no other society achieved anything, or have not made any contribution. Hence the keyword "modern". Why this happened is a complex subject, and I encourage everyone to read Pulitzer Prize winning "Guns, Germs and Steel" by Jared Diamond - one of the best books I have read.

But was this achieved in Europe because of Christianity or in spite of it ? The authors agree that there was a dark medieval period due to corruption in the Church, but still claim that Christianity is somehow responsible for reason and freedom of thought. That's simply an overreach. I am aware that most of the scientists, including Newton and Darwin, were Christian and religious. Still, if Christianity played a role in their discoveries and inventions, it was miniscule. And what about the political thinkers and philosophers, who formulated the theories and affected our way of thinking ? How much of the credit for the work done by all the thinkers from Adam Smith to Carl Marx can be attributed to Christianity - probably none.

If there were no religious angle to their arguments, the book would have had great merit. As it is, I guess this book will have an appeal to someone leaning towards the Conservative Christian spectrum of politics. For most others, it will be frustratingly unsatisfying.

Sunday, November 25, 2012

Alaska Animals and Birds

One of the main reasons to go to Alaska was to see the wildlife - especially the Grizzly Bears. Watching a grizzly bear fishing in the Kenai river was like a dream come true.

As I found out, taking pictures of wildlife is not so easy. They have more important things to do - like finding food for themselves and their family - and are not really willing to pose for the camera. In spite of the not-so-great quality of the photos, they still are warm reminders of an unforgettable experience.

You can click on any photo to start a slideshow.

This big guy was just over 50 feet away. He had found a nice secluded spot for fishing. He quickly found a fish and disappeared into the woods to eat.

It's very common to see the moose along many spots near the highway. This baby moose was slow to follow its mother into the thick tall bushes, so I could capture a few snaps.



Denali visitors are greeted with this sign. Notice the nails on the border. When the bears started chewing on the sign, these were put to prevent them from devouring the whole board !

We saw more than a dozen bears in one day.



A sow with 2 cubs.


The biggest surprise was seeing a wolf. In the millions of square miles, there are just over 70 wolves. So their sightings are rare.



There are many types of marine mammals too. The cutest are the Sea Otters. They prefer relaxing in ice cold water.


Another main attraction of Alaska is the Bald Eagle. It's a pleasure to see this huge and majestic bird smoothly glide across the sky.


Magpie is a very common bird seen nearly everywhere in Alaska.



One highlight was the colony of Kittiwakes, thousands of them nesting on sheer vertical cliffs.


Among the many migratory birds are the famous Sandhill Cranes.


These are all in the wild. If you love nature, Alaska is definitely a place to visit.

Sunday, November 11, 2012

Why I am happy about President Obama's reelection ?

I am neither a Democrat, nor a Republican. I tend to like positions taken by people who call themselves "Libertarian". Honestly, I don't like any label. I do not even want to be considered an "Independent". I would prefer to be labeled as "A Man With No Label". :-)

The ideas that appeal to me a lot are founded on fiscal conservatism, individual responsibility, personal liberty and small government. Especially the last one. Government ought to play as little role in our lives as possible. That sounds more like a Republican. So why am I happy that President Obama won ?

I voted for President Obama in 2008. I was very hopeful for a real change. I feel disillusioned like many others, but I still think it was a right decision to vote for him. He is not perfect, no one is. The types of issues a US President deals with are highly complex. It's not always easy to put the decisions in binary buckets of right and wrong. Reality is more nuanced, with very few moral certainties. I like his handling of foreign policy, especially ending the war in Iraq and hopefully in Afghanistan. The drone strikes are a much more complex issue. Such issues present very troubling philosophical questions. That's true even for the decisions about Economy. The bailout of the Auto industry can clearly be seen as against the principles of Capitalism. At the same time, it has been really positive. At least in the short term. These are issues on which arguments can go on forever.

My biggest disillusion comes from the fact that, the big boys on Wall Street have escaped without consequences for their actions that caused the economy to collapse. Maybe proving criminal intent is tough in such matters. Maybe their money has bought influence, and hence so few cases have been brought against Wall Street by the Obama Administration. A clear wrong decision was to appoint the same people - Lawrence Summers, Timothy Geithner - who share the blame for the crisis, in charge of solving the crisis.

The trickiest issue is of course the health care reforms. I do not know enough on this subject, so I am confused. Interestingly, that wasn't really a differentiating factor in the election, as Obamacare seems to me very similar to Romneycare.

These are matters of personal opinion. No president is ever going to make decisions that everyone agrees with. Some decision will turn out to be good, some bad, most both good and bad. So what, if there are decisions that I find wrong ? What matters to me is, does the President have the right intentions ? Does he really care about helping the nation ? I think President Obama does. I never thought that about Romney. How do I know that's how they really feel ? I don't. It's my perception based on their words, their actions and their life. You can say, the President fooled me. Maybe he did. But Romney certainly didn't fool many. And that's the point.

More importantly, most of the Republican Party seems that way to me. It’s not that the Democratic Party has fooled me. I don't believe for a minute that the Democratic Party is the party that cares for poor, and for minorities, and for immigrants. They just don't seem to be openly against these groups, they may be even pandering to them. The Republican Party on the other hand seems to be pandering to only rich, and to a small section of the country. If that's an incorrect perception, then the Republicans haven't conveyed their message effectively.

That's unfortunate. I don't want the Republican Party to be labeled as such. For better or worse, these are the only two parties we will ever have for the foreseeable future. I want both of them to be strong, to counter balance each other. I live in California, and the state government is scarily Democratic. It's a big government that seems to be controlled by public unions and always looking for excuses to increase taxes. I tend to vote Republican in local elections, but my vote hasn't mattered much.

Without a strong Republican opposition, the Democratic controlled government may very well spend us to bankruptcy. But how can I believe in Republican cries for fiscal conservatism when they care about it only when not in power ? When President Bush started two wars without funding, and was increasing the deficit by providing tax cuts to the wealthy, the Tea Party was nowhere to be found. How can I believe a party (or its candidate) when social welfare is claimed to be dragging the country down, but corporate welfare is seen as a solution ? How can a hard working person who fails to earn over the minimum income tax bracket is seen as a free-loader, but a corporation which succeeds in using tax loopholes to avoid paying a dime in taxes is something to be proud of ? It's possible that the people who give their vote to the Democratic candidates do not hate rich, contrary to what is often claimed, and perhaps they see that the rich have rigged the system, and hence support increasing the taxes on them.

The Republican Party's message about fiscal conservatism is muddled, sounds hypocritical and generates suspicions. That's not all. It comes with the baggage that's impossible for me to accept. For example, global warming to them is an opinion, not a scientific fact. What we need is a debate on effectiveness of the solutions, not a debate on whether global warming is real. Their views on the issues surrounding women's health are outright despicable.

It's legitimate for them to question President Obama's competency. He should be called on the embarrassing debacle on "Operation Fast and Furious" and complete mishandling of the Benghazi situation. But it has to be done in the total context of his foreign policy, which includes many accomplishments as well. He didn't sell out America, he made mistakes. Even Republican presidents make mistakes. He could have done more to help the economy, sure. But he did quite a few positive things, and recovery, albeit slow, is happening. Let's be real. Neither President Bush can be completely blamed for the economic collapse, nor President Obama can be completely blamed for the tepidness of the recovery. The repercussions of the deleveraging caused by the collapse of asset bubbles will go on for a long time.

The degree of competence of the Obama Administration is a matter of opinion, which as expected varies along party lines. Even if I agree with republican campaign about the level of incompetency (and I don't), what's the replacement ? Except Ron Paul, every one of their candidates in primary seemed plain crazy. I would have voted for Ron Paul, even with his controversial past. Because he would have been the right choice for our problems today. Put simply, the Republican Party failed to offer a reasonable alternative.

I am happy about the election result. Relieved, more than happy. President Obama's reelection was not just a personal victory. It was defeat of a vicious campaign that started right after his first election. I could never understand the hatred for President Obama. The man received very little cooperation from Republicans. It was as if they cared about defeating him more than helping the country. It backfired. In spite of the state of the economy.

I hope the Republican Party takes a cold hard look at their failings. I hope they are led in future by someone more like Chris Christie, Rand Paul, Marco Rubio and not Paul Ryan or Sarah Palin. I hope they figure out that being compassionate is possible while being conservative. That science and God can co-exist quite well for most people. And managing perception about themselves is more important than creating misperceptions about their opponent. Because when both parties are strong viable alternatives, the country as a whole will benefit.

Sunday, November 4, 2012

Project Euler : Problem 49

If you want to challenge yourself at writing algorithms to solve mathematical problems, then Project Euler is a nice site for you. The problems have a wide range of difficulty. I found the problem 49 surprisingly rich in terms of strategies that can be employed to solve it.

The problem statement is :
The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are permutations of one another.

There are no arithmetic sequences made up of three 1-, 2-, or 3-digit primes, exhibiting this property, but there is one other 4-digit increasing sequence.

What 12-digit number do you form by concatenating the three terms in this sequence?
Unusual indeed. The numbers have to be prime and permutations of each other, and make up an arithmetic sequence.

Of course, there are many ways to solve the problem. One obvious candidate is use some sort of brute force approach. But what's the fun in doing that ? So I decided to try an efficient approach. I am sure there are many alternatives. The one I tried is as follows.

Note that there are 3 unusual properties. I used them to break the problem in 3 steps and wrote a small, efficient program for each step.

1. Generate Prime Numbers.
Obviously, if we inspect only the 4 digit prime numbers, it's going to reduce the problem space and speed up the solution. As long as generating prime numbers is not expensive. The standard textbook solution for this is to use "Sieve Of Eratosthenes", that offers a near linear algorithm to generate the prime numbers. You can find more explanation here. Using this program, we generate a list of 4-digit primes in ascending order.

2. Group the numbers that are permutations of each other
By treating the numbers as string of digits, we can compare any two numbers to check if they are permutations of each other. The brute force algorithm will have O(N^2) complexity. I wrote an algorithm with linear complexity that works especially well when the cardinality of alphabet set is not very high. You can find the algorithm here. With this step done, we have grouped together all the 4 digit primes that are permutations of each other. Since the original list of all the primes was already in sorted order, each group is also sorted in ascending order.

3. Find the arithmetic sequence
This is bit harder than the first 2 steps. Now, if you just want to examine a given sequence of numbers to decide if it is an arithmetic sequence, then that's very easy to do. But that's not what I wanted. I wanted to write an algorithm to find all the arithmetic sequences within a given sequence. Solving this more generic problem is NOT necessary to solve the Project Euler problem. Becase we are told that the sequence contains only 3 numbers. Moreover, we have already grouped the numbers based on permutations. So either the group is a desired sequence or not. That's simple to test. But if you were not given the problem specific information, then you have to find an arithmetic sequence within  a larger sequence. For example, I found a set of 11 primes that are permutations of each other. The entire set is not an arithmetic sequence. But a subset could have been. You can find the details of my solution to the generic problem here.

By connecting these steps, you can find the solution of the problem. On my MacBook Pro, it took less than one minute for my Java program to generate all the prime numbers, group them based on permutations and find the sequence.

Some interesting facts. There are 174 permutation groups within the 4 digit primes that have more than 3 members in it. For example
[3253, 5233, 5323] 
[6899, 8699, 8969, 9689] 
[2039, 2309, 2903, 3209, 9203].

The longest two have 11 primes in each !
[1237, 1327, 1723, 2137, 2371, 2713, 2731, 3217, 3271, 7213, 7321] 
[1279, 1297, 2179, 2719, 2791, 2917, 2971, 7129, 7219, 9127, 9721].

But none of these contain any sequences.

The most curious fact is not mentioned in the problem. The other prime permutaiton sequence, has exactly the same difference in it's terms, 3330 !! That means : The only 2 arithmetic sequences of 4 digit primes such that the numbers are permutations of each other, have exactly the same difference. The one was already given in the problem. The other one we have to find. Both sequences have the same difference, 3330. Really interesting.

The Project Euler guidelines suggest not to disclose the solution. It's OK to explain the strategy. Hence I have not given the solution here.
Related Posts Plugin for WordPress, Blogger...