About Me

My photo
Science communication is important in today's technologically advanced society. A good part of the adult community is not science saavy and lacks the background to make sense of rapidly changing technology. My blog attempts to help by publishing articles of general interest in an easy to read and understand format without using mathematics. I also give free lectures in community events - you can arrange these by writing to me.

Friday, 25 March 2016

Variations on Magic Squares - Interesting Party Games

Blog Contents; Who am I?

An nxn magic square is an arrangement of the numbers from 1 to n^2 (n-squared) in an nxmatrix, with each number occurring exactly once, and such that the sum of the entries of any row, any column, or any main diagonal is the same and is equal to n(n^2+1)/2.

Magic squares are fascinating objects.  I have always found them intriguing - how do they construct magic squares was a question that I could never find a sensible answer to. Wiki has all the historic and mystical significance of magic squares - we shall miss this out here - you can have a look for background reading. 

Recently, I happened to stumble on a book about magic squares and decided to find out how to make one.  3x3 is easy and straightforward.  4x4 recipes on the internet, Youtube and the rest all looked very complicated.  Thankfully after a few hours of struggle, I could find my own way of easily making 4x4 pseudo-magic squares - a simple method that is trivial to remember. (Strictly - this is not a true magic square as the numbers are repeated but we shall ignore this as it still makes an excellent party game - actually more fun as some of the complexities of magic squares is taken out)
This exercise also allowed me to dig out some very interesting party games constructed around the 4x4 grid and I shall describe a couple of games here at the end of the blog.

3x3 Magic Square:   In the strict definition of a magic square, a 3x3 square must add to 15 (see the formula at the end of first para)
A general recipe to construct a 3x3 number square is as follows (I call it number square as the sum is not equal to 15 and numbers can be in any range and not necessarily from 1 to 9 as per definition of a magic square)

As you might have guessed, N=5 for a true magic square. But you can make it for any other number and choose a and b to get a good spread of numbers.  Remember 2a + b must be less than N otherwise you will get negative numbers but that is still okay - great to have a magic square with negative numbers!
4x4 Magic Square:  
A 4x4 magic square has numbers from 1 to 16 and the sum of rows, columns and diagonals should be individually equal to 34.  In the following, I show how to construct a 4x4 magic square:

This is the pure magic square as per definition. 
Now we look at some generalizations which make interesting party games:  
Party Games:  Variations on 4x4 Magic Square:  
Game 1:  I call it the A-Square  (some numbers are repeated etc.) as it is not strictly a magic square. The best way to describe the game is to play it.  Follow the instructions in the slide:  

One does not have to limit to sum being 38.  The sum can be any number - birthday at the party, for example or the wedding anniversary.  

Game 2:  This is a simpler way to make a 4x4 number square that I concocted up.  Easy to remember and only uses four numbers instead of eight so there is more repetition of numbers in the grid.  Follow the slides:

Hope you have enjoyed reading this.  

Post Script:  The purist will not like this blog.  nxn Magic square by definition is unique - so what do you do with it?  By taking liberty to go beyond the strict definition, we have got some interesting games which are quite manageable even for youngish children and of course adults will enjoy these as well.  

Friday, 18 March 2016

Magical Number 1001 - Maths Game to Wow

Blog Contents; Who am I?

I love to break the pleasant monotony of science writing by something that can be really good fun.  
In this blog, I shall talk about a number game and end with describing the magic of 1001.

The game requires the help of a basic four-function calculator - so have one handy.  
Let us start

1. Think of a three digit number - any number that you fancy. For example, let us choose 283.
2. Place this number next to itself to generate a six digit number.  This will be 283283 in our example.
3. Add 343 to this number and divide the sum by 7
4. Subtract 137 from the result and divide by 11
5. Add 8 and divide the result by 13.

What do you get?  In our example, you will get back 283 - the number you chose in the first place.  Cool!!

This will work for any three digit number whatsoever that you choose.  You can also choose 1 or 2 digit numbers so long as you add zeros to the left to make them three digits.  
If you choose 7 then make it 007, or if you choose 53 then make it 053 and the six digit number will be 053053.

There is a shorter version of this game.  In the simpler version, just divide the six digit number, you have created by 7, 11 and 13 and you retrieve the number you chose in the first place.  It works but it is less fun and carries a smaller wow factor.


The reason this game works is because of the number 1001 that has for its factors the three prime numbers 7, 11 and 13.  

Also the multiplication of any three digit number by 1001 just makes it a six digit number with the initial number repeated.  By constructing the six digit number, you were effectively multiplying it by 1001.  
Like all good puzzles, it is really simple when explained.

The first puzzle here is something I concocted so that it looks more mysterious but the basic idea is the same.


Hope you enjoyed the little game.  Let me know.


Tuesday, 15 March 2016

Another Step towards Achieving Artificial General Intelligence: AlphaGo triumphs over the World Champion of the Game GO

Blog Contents; Who am I?

Everybody is talking about the defeat in the board game GO of the reigning world champion Lee Se-Dol by the program AlphaGo - the score stands at 1-3 in the best of five contest.  GO is an ancient Chinese board game (458 BC) which is far more complex than Chess.  In 1997, by defeating the then world chess champion Kasparov, supercomputer Deep Blue cleared that hurdle .   Then, IBM's supercomputer Watson defeated the Jeopardy world champions in 2011.
Chess and to some extent Jeopardy may be played by a computer with enough crunching power - a brute force approach - and these computer victories would suggest that artificial narrow intelligence (ANI), task-specific intelligence, has been achieved by computers like Watson.

Lee is one of the best ever GO players and his defeat at the hands of AlphaGo is particularly remarkable. To play GO at the highest level requires an ability in dealing with abstract strategic concepts and intuitive human-like style of game play - something that the experts were predicting to happen, maybe after 10 years.  
Lee remarked:  "I don't know what to say,..., I kind of felt powerless."
AlphaGo's creator Demis Hassabis (CEO Google Deep Mind)  said: "To be honest, we are a bit stunned and speechless"
The next two slides describe the challenges that computers face in playing GO by brute force crunching power only: ( The slides may be skipped without breaking continuity of the text  but click on a slide to view bigger image)

The victory of AlphaGo points to the first steps that are necessary in the development of Artificial General Intelligence (AGI): Sometimes referred to as Strong AI, or Human-Level AI,  Artificial General Intelligence refers to a computer that is as smart as a human across the board—a machine that can perform any intellectual task that a human being can. Creating AGI is a much harder task than creating ANI.  Professor Linda Gottfredson describes human intelligence as “a very general mental capability that, among other things, involves the ability to reason, plan, solve problems, think abstractly, comprehend complex ideas, learn quickly, and learn from experience.” AGI, when properly developed, would be able to do all of those things as easily as you can.
Consider the sheer complexity in a game of GO relative to Chess.
A game of chess can go 10123 different ways. The number of atoms in the universe is less than 1081. A game of Go can go 10700 ways - a number so large that it is difficult to imagine what it means.  That a computer can master such a complicated game gives us some idea of the pace at which AI is improving.

Google DeepMind, AlphaGo's creator, has developed a system called deep-Q Network (DQN), that can quickly master a range of Atari 2600 games – Space Invaders, Breakout, etc – based on nothing more than raw pixels and game scores. DQN differs from Deep Blue or AlphaGo in one crucial way: it’s not limited to a single task. The games it has mastered have diverse rules – but the DQN can solve them all with just one algorithm.  
(click on slide to view bigger image)

DeepMind says that its work is:

... the first demonstration of a general-purpose agent that is able to continually adapt its behaviour without any human intervention, a major technical step forward in the quest for general AI.” 

DeepMind's chief executive, DemisHassabis said that its AlphaGo software followed a three-stage process, which began with making it analyse 30 million moves from games played by humans."It starts off by looking at professional games," "It learns what patterns generally occur - what sort are good and what sort are bad. If you like, that's the part of the program that learns the intuitive part of GO.""It now plays different versions of itself millions and millions of times, and each time it gets incrementally better.
It learns from its mistakes.
Tested against rival Go-playing AIs, Google's system won 499 out of 500 matches

Jason Millar in the Observer states that Deep Learning represents a paradigm shift in the relationship humans have with their technological creations.  AI can display genuinely surprising and unpredictable behaviour (not expected from brute crunching computers).  Lee described being stunned by an unconventional move he claimed no human would ever have made. The creators of AlphaGo were very pleased with some of the surprising and beautiful moves that AlphaGo played.

Millar writes "Possessing more intuitive approach to problem-solving allows artificial intelligence to succeed in highly complex environments.  AI is also increasingly able to manage complex, data-intensive tasks such as detecting cyber security threats, high-frequency stock trading etc.  Embodied as robots, deep-learning AI is poised to begin to move and work among humans - in the form of service, transportation, medical and military robots." 

The speed of progress in AI is only going to accelerate - AlphaGo is an excellent proof of that - the question is if the human society is capable of understanding and acting quickly enough to  adjust to the new paradigm.  We move far too slowly - the complexity of human civilisation dictates that - but this could be our undoing.  I have no suggestions how humans can manage the fantastic rate at which AI is developing  - some suggest that we should stop these developments - that in my view is a fool's delusion.  March of technology cannot be stopped - it is best to be flexible and try to change the social, legal, financial, military systems and whatever else defines the human society to meet the new challenges.

Post Script:  There’s a cute irony to DeepMind. The highly intelligent developers of the technology are doing their best to make themselves obsolete. It might not happen in their lifetime, but DeepMind and companies like it will, sooner or later, make human intelligence irrelevant. Hassabis says, “It’s quite possible there are unique things about humans. But, in terms of intelligence, it doesn’t seem likely.”

Tuesday, 8 March 2016

Future of Privacy - Threats to and Erosion of Privacy in the 21st Century (Part 2)

'People have no privacy - get over it'...Scott McNealy,1999; SUN founder and CEO 
'Living a public life is the new default'
'Privacy will become a 'luxury' - only rich will have it.
'In 2025, everything will be transparent; people will not have the illusion of privacy'

Part 1  (Part 1:  http://ektalks.blogspot.co.uk/2016/02/future-of-privacy-what-is-privacy-and.html ) discussed the importance of privacy for our overall welfare/fulfilment.  It was argued that loss of privacy can give others unfair advantage over us.  Privacy is a relatively modern concept and its meaning changes across different cultures.  It might be fair to say that privacy is a social construct. In ancient times, people had very little privacy; before central heating, members of a family would likely be sharing one or two rooms.  
Religions and also liberal political notions consider privacy as an 'inviolable'  right. The notion of privacy is a continuously evolving one and the way our society is currently organised, it seems desirable to hold on to our privacy in the way Oxford Dictionary (OD) defines it - Privacy is freedom from intrusion or public attention; avoidance of publicity. According to Freud, one needs to escape from the pressures of civilization; it helps if your right to be left alone is respected.
I must emphasize here, that this notion of privacy is being eroded rapidly and will be obsolete in the next 15 to 20 years.

With the advances in digital technologies and the way most people will live their lives in the 21st century, one should distinguish between the two forms of privacy;  
Physical (realspace) and Digital (cyberspace) privacy.  
If privacy is something worthy of protection - then first we need to understand - what are the threats, where are they coming from? We do not consider everything about us as private - we talk to family and friends, health, legal, financial professionals about important confidential aspects of our lives and we do that because we implicitly trust them to keep the information confidential. Without this trust, life will be unbearable. In the pre-internet age, before 1995, we could share, with reasonable confidence, private information with people we trusted - is this still so?

Threats to privacy could come from various sources:
1. Self - We can lose privacy by our actions
2. Business - Information about us is useful for them 
3. State - The most serious violators of privacy (see Part 3) 
4. Criminals - Cyber crime is expected to increase in future
5. New Technologies - ??  (IoT, see Part 4)

Let us look at what people's anxiety is about privacy

Only 0.05% of people have lot of trust on social networking websites to keep data about them secure.  This rises to 1.5% for online retailers, 2% for governments and 3% for retail stores loyalty cards etc.  Not a big vote of confidence!

Threats from Self:  A large number of surveys have been done; consistently 70 to 90% people say that they are worried about their privacy but they feel they have no control on how information about them is shared. While people appear to want more privacy, they voluntarily give away their privacy knowing full well the consequences.  On social media, one will post information about their holidays - inviting burglars.  Some insurance companies will not cover you for break-ins if you have posted your holiday plans on the internet.  Intimate details about what you do and think are shared with 'friends'. The growing trend of instant response to events gives away a lot of psychological information about you.  People seem to want to be famous - they will object about loss of privacy but they never leave the public platform and continue to advertise their intimate details.  What we are observing is the gradual fading away of the expectation of privacy as a fundamental right in the 21st century.  The choice appears to be that either you sacrifice your privacy or lose out on the comfort and convenience that the digital age provides you. The new generation, born after year 2000 will only know the new paradigm and will not rue the loss of privacy the same way as the older generation might.  
We shall look at the way businesses, governments and criminals collect and use information about people in Part 3. 

Let us look briefly, the methods by which your personal information may be manipulated.  Most information about us is readily converted into digital form on some database; from this stage our privacy faces the most serious threats.  Some of the ways our personal information may be affected are discussed in the followng:
1.  Data Merging:  We voluntarily give organisations personal information about ourselves to complete a transaction.  For example, we give information about our income and credit history to a bank to secure a loan, or give information about our medical history to an insurance company to take out life insurance.  Both organisations have a legitimate need for the information to help them make a decision.  We have given the bank and the insurance company the required information for a reason and no breach of privacy happens up to this point but we give personal information with the understanding that it will not be used for any other purpose by transferring  to or sharing with other organisation.
If the bank and insurance company share the information on their databases about us without our consent/authorisation/ knowledge then a breach of privacy occurs and we lose control on our information.  When one company merges or is bought over by another company, then their databases are merged and we have no control on how our data is handled.
Another example is the national identity card system where it is claimed that by having all our personal information on one card will make life much simpler.  This requires merging a large amount of your personal data in one place and the department, that you are dealing with, will also have personal information which they do not require.
2. Data Matching:  This happens when records on a database are used to match similar records on another database.   For example, faces of football fans entering the stadium are digitised in a facial recognition system and can be matched in real time with a centralised database to suspected terrorists and criminals. Or the tax office might use records held by department of social security to ascertain if  you were illegally claiming benefits.  As we shall see later (Part 3), the probability of misinterpretation of information from an independent database can be quite high and completely false decisions can be made without very strict codes of operation - sadly, many incidences are proof that this is not so.
3. Data Mining:   Large amount of information is being collected about the population.  This is a gold mine for companies and institutions in their attempts to understand broad commercial and social trends.  A knowledge of such trends can be exploited in making money for the companies by directly marketing goods and services to individuals.  Such information can be effectively used to influence political and social activities of a group of people.
Cookies on the internet & smartphones and loyalty cards issued by retailers are some of the methods for creating a lot of information about your shopping habits, your likes and dislikes, the group of people you are in most contact with etc. This information can be used to create a good personality profile for a large section of the population.  Additionally, information about you collected by one source may be accessed (either by agreement or by making a payment for it) by another institution.  All this can happen without your consent - although is many cases, you do provide the initial information willingly but then what choice one has?  If you do not accept cookies, many internet sites will not let you proceed to the next stage etc. - so you are not in control of what information about you can be collected and shared among institutions.

In Part 3, we shall look at the role of the State in collecting information about us, how they use it and what implications this might have for the future of our privacy.    

Blog Contents; Who am I?

Thursday, 3 March 2016

Life on a Spherical, Rotating, Tilted Earth - Curved 2D Space - Fascinating Insights into Geometry, Climate, Weather, Seasons, Gravity ...

(please click on a slide to view it bigger image)

The earth is spherical (almost) but we spend most of our life on a piece of land that is flat locally.  Our common sense develops in a way that is appropriate for a flat earth.  Even the geometry that we learn in school is Euclidean – that is – flat space geometry.  We hardly ever think about what it means to have a spherical earth.  Start delving into this question and a whole lot of fascinating insights spring up and that is the journey we shall make in this post – hope you will enjoy it and give some thought as to what life might be like on a flat earth.  Very different for sure – it may not even be  possible for life to survive on a flat earth.

General Background:  Earth is the 3rd planet in the Solar System – on average about 150 million km from the Sun.  It completes one revolution round the Sun in about 365 days 
The earth’s axis is tilted by about 23.4o relative to the direction perpendicular to the plane of the earth’s orbit. Average speed of the earth as it revolves round the Sun in its 970 million km long orbital path is 30 km/second or 67,000 mph.  

The next slide shows the spinning earth – it completes one rotation in 24 hours.  Because earth is spherical and it spins, we have nights and days - light from the Sun falls as a parallel beam on the earth and illuminates the part facing the Sun.  The radius of the earth is 6375 km; at the equator its circumference is 40,700 km and the speed of spin is 1670 km/h (1000 mph).  Because of its spin, the earth bulged a little at the equator; but it is spherical to a very good approximation and we shall consider it to be so in our discussion.  
Earth also has gravity and attracts all objects towards its centre.  The slide also shows how a person standing upright at the north pole finds that somebody stands upside down at the south pole; and sees people standing at all sorts of funny angles in between.
 Points on the surface of the earth are located by their latitude and longitudinal angles.  The equatorial plane (the circle that divides the earth in two equal halves) defines the zero degree latitude.  

Latitude of a point on earth’s surface is the angle that the line joining the point to the centre of the earth makes with the equatorial plane.  Longitudes run from 180oW to 180oE.  Half circles passing through the centre of the earth and the two poles are perpendicular to the equatorial plane and define the longitudes.  0o longitude (the prime meridian) passes through Greenwich, London.  Longitudes (meridian) run through from 0 to 180o in the East and West directions from the prime meridian and they meet at the International Date Line in the Pacific.
Spherical Geometry:  In order to really appreciate how spherical earth is different from a flat earth, let us look at the difference between flat (Euclidean) geometry and spherical (non-Euclidean) geometry.  The following slides demonstrate this difference.  (click on the slide to see its bigger image in a new window)

 On a spherical surface, our experience can be counter-intuitive and puzzling.  I have two puzzles here – see if you can figure them out. The answers are at the end of this post.
Puzzle 1.   After lunch, Euclid leaves his tent and walks 1 km to the South.  He then turns and walks 1 km to the East.  After a short tea break, Euclid walks 1 km to the North and finds himself at his tent.  How is it possible?
Puzzle 2.  Riemann leaves his tent at 10 am and start walking due North for 2 km.  After enjoying his lunch, he again walks due North for 2 kmSurprisingly, he finds that he has returned to his tent.   Can you explain this?
How far is the Horizon?: The ground around us always feels flat because our field of view is generally quite restricted – distances we see are only a few km – and with the earth’s radius being 6375 km – a few km patch of land will appear flat.  Flat (Euclidean) geometry will be a good approximation for our field of view and will work well over such short distances.  Even then, the curvature of the earth restricts the distance we can see – how far is the horizon? – In ancient times, this is how philosophers had concluded that the earth is not flat.
Navigation:  When we travel from point A to point B, we think of travelling along a straight line which is the shortest path between any two points on a flat surface.  This is not so on a curved surface; the shortest path on a 2D curved surface, like our earth, is a geodesic or the arc of the great circle passing through points A and B. This is shown in the slide 

 Airplanes and ships that travel over large distances choose to travel along geodesics to minimise travel time and fuel costs. See slide for an example.
A Parable:  Life on a spherical surface can be very confusing!
Climate:  The earth receives most of its energy from the Sun in the form of electromagnetic waves and lot of it in the visible region.  Rays from the Sun fall on the earth and deliver much more energy in the equatorial regions; amount of energy received per unit area reduces as we travel towards the poles.  This is shown in the following two slides: 

 The result is that the land and waters near the equator warm more than near the poles and a process of heat transfer ensues.  Our climate, atmospheric and ocean currents are largely determined by this process of heat transfer. I have discussed these subjects in detail in my outreach talks suitable for the general community and may be accessed in the links:      Climate          Atmosphere             Ocean

Consequences of Earth’s Spin:      The earth and its atmosphere spin (rotate) about the earth’s axis completing one rotation every 24 hours. The rotation of the earth gives rise to some very interesting effects; we shall look at a few of these here.  For ease of explanation, we shall talk in terms of centrifugal and Coriolis forces which are ‘fictitious forces’ observable in the frame of reference of the rotating earth.  They give the correct results and are widely used in general discussions.  
Earth bulges at the equator:  Because of the earth’s rotation, every object on the earth’s surface is moving with the earth at a speed of 465 m/sec or 1000 miles per hour and feels an outward force – the centrifugal force – directed away from the centre of the earth.  Its magnitude is proportional to the square of the linear speed divided by the radius of the earth at that point.   The linear speed of rotation v and hence the magnitude of the force is a maximum at the equator, decreases with latitude and is zero at the poles.
The centrifugal force causes the earth at the equator to bulge out and the earth has a larger radius at the equator than at the poles  - it is an oblate spheroid – the extent of the bulge is small; the earth’s radius measured across the equatorial plane is 6378 km compared to its value at the poles of 6357 km.
You are less heavy at the equator: All objects feel an attractive force directed towards the centre of the earth - gravitational attraction.  Gravitational attraction is largest at the poles and you weigh more there than at the equator. Your weight at any point on the earth is the product of your mass (m) and the acceleration due to gravity (g) at that point. 
Centrifugal force acts in exactly opposite direction and reduces the amount of earth’s gravitational attraction at all places – hence your weight is reduced.  This effect is greatest at the equator and your weight is reduced by about 0.5% relative to what you will weigh at the poles.  For a more detailed analysis, see the slide (your weight = mass x g)

Coriolis Effect (Force):  Is a force experienced by moving objects in a spinning earth.  The force depends on the speed of the object, the direction it is moving and on the earth's rotaional (angular) velocity.  It  is mathematically difficult to explain but for the particular case of an object moving from the Equator to North Pole, Coriolis Effect may be understood as follows:
All points on the earth complete one full rotation through 360 degrees in 24 hours (constant angular velocity) but a point at the equator has to go farther in a day than a point in Glasgow at a latitude of 56oN.   Object at the equator have a bigger eastward velocity than objects at more northerly latitudes.  As the object travels north, it will be going east at a faster speed (easterly speed it had at the equator) than the ground beneath and its path will deflect east  - it will seem as if some mysterious force is acting on the object.
Objects travelling towards the equator will have a smaller eastward speed than the ground beneath them and they will seem to be forced west. 
The angular velocity of Earth is 360 degrees per day (one rotation per day), or 73 microradians/s. At wind speeds of 20 m/s (or 50 m/h), the Coriolis Effect generates an acceleration of about 0.003 m/s2.   Over an hour, this is a total deflection of about 18 km.
Coriolis effect is responsible for the way atmospheric air circulation and ocean currents are. Because of the uneven heating of the different regions of the earth by the Sun, heat transfer happens and air and water masses move from hot equatorial regions towards the polar regions.  Coriolis effect causes the flow of air to be modified as explained above and creates a much more complex air circulation patterns than would exist if the earth were not spinning.  This is explained in the following slides:

With Coriolis force the pattern looks as in the above slide.

Earths Tilt:  The earth's axis is tilted at 23.4 degrees with respect to the ecliptic plane (the plane of earth's orbit around the Sun) and maintains this tilt during its orbital journey.

At any time of the year, the northern and southern hemispheres receive energy from the Sun in different amounts.  This is responsible for the earth to have seasons.  I have discussed this topic in detail in my post and I refer you to that post.  
Another interesting aspect of the earth's tilt is that the tilt changes slowly with a period of 41000 years.  

As the tilt changes, the amount of sunlight falling on the earth changes over the course of its rotation.  This can act as a trigger for the onset of ice ages.  The cause of ice ages is a bigger topic and is discussed under Milankovich Cycles in my post.  


POST SCRIPT:  We have gone over some of the fascinating aspects of life on a rotating spherical earth and looked at how this creates a large variety of events both over short and long time scales.  
The earth is spherical was established historically by observations of length of shadows, finite horizon distances, shape of earth's shadow in lunar eclipses and now by actually photographing the earth from space.  Against this background, I find it amazing that there are people who claim that the earth is flat.  This is a matter that I think falls in the realm of mental aberration - I am not a psychologist  but when otherwise sensible humans who lead a normal life can still believe that the earth is flat then I start to wonder about how our minds are organised.  To me, this represents a bipolar mind - switching between logical and illogical states . Is bipolar mind an illness or human mind is naturally organised in a multipolar mode?  I can think of many aspects of life - religious belief is another example - where a multipolar mind can quite happily live with contradictions.  Human society throws many contradictions; is multipolar mind just a strategy to cope or is it genetic or is this a real disorder (illness)?  I would like to understand.