Sunday, December 11, 2011

Magic Square: Lo Shu Metric!

Let us indulge in the topic of Magic Squares today – simply put, it is a square grid into which whole numbers are placed. The whole numbers themselves need not follow any order but they must be distinct, and placed in such a way that each horizontal row, vertical column and diagonal add up to the same number. 

Let us illustrate by means of an example:

A 3 x 3 'Lo Shu' Square
Observe:

1st Row: 8 + 1 + 6 = 15
2nd Row: 3 + 5 + 7 = 15
3rd Row: 4 + 9 + 2 = 15
1st Column: 8 + 5 + 2 = 15
2nd Column: 1 + 5 + 9 = 15 
3rd Column: 6 + 7 + 2 = 15 
1st Diagonal: 8 + 5 + 2 = 15
2nd Diagonal: 6 + 7 + 2 = 15
This magic square is known as the 'Lo Shu' square and was known in China around 3000 BC. Legend says that it was first seen on the back of a turtle emerging from the Lo river - the natives then took it as a sign from the gods that they would not be freed of pestilence unless they increased their offerings.

But really, is there a systematic way of generating such magic squares? Indeed there is! There are several methods, of which the likes of trial and error I shall not mention, haha. Suppose we go by a logical algebraic method:

1) For a 3 x 3 square, there will be 9 numbers, whose sum is given by:

S = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45

Since each row must add up to the same number, dividing this by 3 means that each row/column/diagonal must add up to 15.

2) Let us now consider the central cell and label it x:

The Blank Square
We know that each row, column and diagonal must add up to 15, and so if we add up the middle row, middle column and both diagonals, we have them adding up to 60:

15 + 15 + 15 + 15 = 60

Now, pause for a moment - if you take the sum of the middle row, middle column and both the diagonals, that's equivalent to taking S + 3x = 60 because you're adding all the numbers from 1 through 9 once, and then adding them to 3x.

Since S = 45, then surely:

3x = 15 and therefore x = 5

And of course, we can carry on ad infinitum, ad nausea, via a system of simultaneous equations that can be solved for every single element in the grid we see above.

But surely, surely there must be an easier method!

Well, guess what? There is one! Simon de la Loubere, the French ambassador to the King of Siam in the late 17th century, wrote down an algorithm for constructing magic squares that have an odd number of rows and columns:

1) Place a '1' in the middle of the first row.

2) Go up one cell and then one cell to the right (order doesn't matter) to place successive numbers.

3) If the cell is blocked, the successive number should be placed beneath the current number.

Let's illustrate this awesome rule:

The 'Loubere' Algorithm
And there you have it:

A 3 x 3 'Lo Shu' Square
Using this algorithm, you can easily create any magic square that has an odd number of rows and columns. :)

Saturday, December 10, 2011

Pendulum Wave

It's been about 2 years since I last posted anything, so here goes:

Suppose for a minute there you believe me that the angular frequency of a pendulum is given by:


Where L is the length of the pendulum and g is the gravitational field strength. Well, none of that matters really, suffice to say that the longer the pendulum, the faster the oscillation for a given gravitational field.

In the video below, you’ll see that the pendulum bobs with a longer string length swing with a lower frequency than those with shorter string lengths, in accordance with the equation above.

What do you notice? Notice how the pendulum bobs start to swing in a synchronized fashion and then gradually start to lose their synchronization. This generates the nice pattern we see. Can we apply any quantitative explanation to this nice pattern of synchronization we see? Yes we can!

Now, suppose you now believe me (again) that the pendulum swings in such a way that when you follow the horizontal component of its displacement from equilibrium, it traces out a sinusoidal curve with respect to time as follows (I’ve left out all axes for simplicity):


Now imagine you have many different pendulums, all of different lengths – each pendulum bob differs from its preceding and successive pendulum bob by just a small change in its length. Then you you would expect the sinusoidal curves traced out by each bob to be slightly different due to different frequencies, as such:


The sinusoidal curves are all of different frequencies, though differing only slightly from one another – occasionally, one might expect the pendulum bobs to swing in phase and synchronize with one another, but most of the time, the pendulum bobs swing out of phase and are asynchronous due to their different frequencies.

So what does your eye see when you superpose all of the pendulum motions together? Well, essentially, there will be a period of time when the pendulum bobs all seem to be swinging in sync and then because of their different frequencies, they slowly start to swing out of sync, and then slowly again, they swing in sync. So if you add up all of the sinusoidal curves for a representative interpretation, you obtain this:


This is known as a wavepacket – the amplitude (how high the wave is) represents how coherent, or how in sync the individual pendulums are with one another. In the central portion, the amplitude is high, meaning the pendulums are almost swinging in sync. As time progresses, the pendulums swing out of sync, and you see the height of the wave packet decreases.

The motion is however, periodic, so you see the same patterns repeating over and over again, though with decreased amplitudes due to loss in kinetic energy.

That’s essentially it, but I haven’t made any additional effort to correctly quantify the patterns that we see. So sorry!

Monday, September 7, 2009

Ass'N Tool (Pun Intended!)

Well, so we all know (or do we? Haha!) that the famous SN2 reaction proceeds via a 'backside' attack.

Yep, you got that right - when the nucleophile attacks an alkyl halide, it hits it right on its gluteus maximus (actually, I see it from another angle, but never mind).

And of course the age-old question: why? Why in particular, the 'backside'? Well, everything will be made clear with Molecular Orbital theory, so let us consider what the LUMO (Lowest Unoccupied Molecular Orbital) of a typical alkyl halide (in this case, chloromethane) looks like:


Notice the huge lobe on the 'backside' of the carbon atom? That's where the nucleophile attacks if if wants to bond to the carbon atom - by donating electrons into this antibonding orbital, the carbon-chlorine sigma bond effectively breaks, and a SN2 reaction ensues.

Ah well. I probably haven't explained in detail enough. But hey, I'm tired. :)

Tuesday, September 1, 2009

Recollection

I know I've asked this before, but it keeps coming back to me, again and again:

Does a proton possess orbitals?

If you say I'm silly, then consider the thousands of Chemists worldwide who speak of the hydrogen ion (H+) as having orbitals.

Isn't a hydrogen ion a proton?

But isn't a proton a free particle by itself?

Quantum mechanics is just plain weird, period. :)

Tuesday, August 25, 2009

Conquering the FORTress

Mr Yeo has successfully written his quadratic equation solver program, so now all you people out there can use it for their homework. :)

And that's the first step to conquering Fortran! :)

Unfortunately, Yahoo Geocities is closing its server this October, so I shan't bother to post it up; will probably do so when I've found another host. :)

So many smilies. Yay! :)

Monday, August 24, 2009

Water Me Down!

You know, I’ve always wanted to construct a Walsh Diagram for a simple molecule? So what exactly is a Walsh diagram? Well, let me illustrate using water as an example; one should know that water has an equilibrium geometry that is bent, with a H-O-H angle of 104.5 degrees as such:


And of course, the other limiting (non-equilibrium) geometry would be a linear geometry with a H-O-H angle of 180 degrees as follows:


So now the question is, why is the former geometry adopted by water molecule? Phrasing this question another way: is it such that the energy of the water molecule is lower when it has a H-O-H bond angle of 104.5 degrees?

Well, the easiest way to find out whether this is true or not (not so much why it is true!) is to plot a graph of the energy of the water molecule against the H-O-H bond angle.

Now usually you wouldn’t be able to calculate the total electronic energy of the water molecule by hand, but since I’m bundled up with this molecular calculation suite called Gaussian03 (yes, I know the latest version is G09!), I’ve performed the calculations using my trusty laptop.

So here’s the graph, or like how they call it, the Walsh Diagram for the water molecule (click to enlarge):


This graph actually shows that the 104.5 degrees H-O-H bond angle gives rise to a lower total electronic energy of water than the linear geometry! So be convinced! That the Singaporean education system isn't wrong! :)

So the next step comes in explaining why that's the case.

Another time. :p

And all calculations were clumsily performed with a minimal STO-3G basis set using the Hartree Fock level of theory, which merely took 5 seconds or so for each single point energy calculation.

Yay! Time to sleep. :)

Saturday, August 15, 2009

Don't Point So Much!

I'm undertaking this module on group theory, and I noticed something that I never really thought about because I just took things for granted. Now, given that:


And given that the first two results are definitely correct, what can one say about the third?


And well well, here are two molecules where students usually assign the wrong point group to:




If you'd like to try, then don't play cheat and figure it out from scratch! :)

----------------------------------------------

Because I am the lazy person that I am (I'm too tired, :p), the answers are as follows without explanation or elaboration: