Monday, June 16, 2008

The Road Not Taken

Any system which promotes only one mode of advancement, is a system in which people are either successes or failures.

Any person who believes that there is only one mode of advancement, is submitting to such a duality, and is walking on a tightrope.

I ask, why ? Why should we all trod on the same path, to be judged by the same criteria ?

A flawed understanding of evolution is that it is the survival of the fittest, whereas it is not. While it is indeed true that climbing upwards enables survival, moving sideways, and seeking new niches, is also an equally valid alternative.

Admittedly, taking the path less travelled is difficult. But I am convinced that it is a better path.


Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;

Then took the other, as just as fair,
And having perhaps the better claim,
Because it was grassy and wanted wear;
Though as for that the passing there
Had worn them really about the same,

And both that morning equally lay
In leaves no step had trodden black.
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I—
I took the one less traveled by,
And that has made all the difference.
Robert Frost, The Road Not Taken

Saturday, June 07, 2008

NUS Matriculation Number Checkdigit

Out of interest (or perhaps, boredom), I decided to reverse-engineer the scheme by which the checkdigit of the NUS matriculation number is generated. After spending a couple of hours intensely studying some matriculation numbers, I finally reversed the scheme.

For the benefit of those who have less knowledge, a checkdigit is (usually) a number or letter appended to a longer number. Like a checksum, the checkdigit allows people who know the algorithm to very quickly discover whether the number is valid (since a randomly generated checkdigit is more likely to be wrong than correct).

In the case of the NUS matriculation number, the checkdigit is the final letter of the matriculation number, for example W in the case of the number u012345W.

Armed with some knowledge of hashing (since most checkdigits are calcuated by basic hash functions), expertise with modulus mathematics, and finally a list of matriculation numbers and their checkdigits, I was able to uncover the scheme, which follows.

Assume the numerical digits of the matriculation number are 0,C1,C2,C3,C4,C5. From this, calculate the checksum value by the formula:
((C1,C2,C3,C4,C5)*(12,10,12,11,6))+12) % 13
where % is the modulus operator. Compare the checksum with the following table:

BAEHJLMNRUWXY
0123456789101112

The above algorithm should be accurate for all matriculation numbers beginning with "u0". Due to a lack of matriculation numbers beginning with other headers, I was unable to determine the offset for those numbers.

The methods for determining the NUS matriculation number checkdigit algorithm can be applied to find, among other things, the checkdigits of any NRIC number. By the way, that problem has already been solved (just wiki NRIC).

*P.S.* I have since updated the scheme to account for new matriculation numbers prefixed with A**.

Sunday, May 25, 2008

Battleship Solitaire

Recently, I've been playing a type of puzzle called Battleship Solitaire. Basically, this type of puzzle involves a battleship grid, and numbers along the sides of the grid. Based on these numbers, you are supposed to work out the locations of the ships.

In principle, the game works out to be similar in some areas as Paint By Numbers, and hence some strategies which I discovered earlier were viable for this game too. However, this game is probably (at my present skill level) partially dependent on luck, since some puzzles I played were ill-posed, having 2 possible solutions. Of course, this is almost certainly due to the puzzle generator, which does not check for the uniqueness of the solution.

Some sample shots of a new game and a solved puzzle follow.

A puzzle with 9 starting hints.

A solved puzzle.

The rules of the game (copied from this website), for reference, are :

The computer hides the ships in the grid and a few 'shots' will be fired into the grid to get you started (Hints). The ships will be hidden in the grid with the following rules.
  • The ships will be orientated in either the horizontal or vertical direction only.
  • No two ships will be adjacent in any direction including diagonally
  • There is one battleship (4 squares in length)
  • There are three cruisers (3 squares in length)
  • There are three destroyers (2 squares in length)
  • There are four subs (1 square only)
  • The numbers in the right column indicates the number of grid squares occupied by ships in the horizontal direction for each row.
  • The numbers in the bottom row indicate the number of grid squares occupied by ships in the vertical direction for each column.

Monday, May 19, 2008

Quick Question : Alarm Clocks

Just a quick question :

For most analogue alarm clocks, the time and alarm time are adjusted by dials located on the back of the clock. The question is, why can the time of the clock be adjusted by turning the time dial either clockwise or anticlockwise, while the alarm time dial can only be adjusted anticlockwise ?

Tuesday, April 29, 2008

First Divine Skill Under Heaven

Recently, while I was walking on the street, I met an incredibly skilled pugilist. The pugilist was dressed in rags and had unkempt hair. He was clearly from the Beggar Sect, Bukit Panjang Branch. Perhaps he was even the leader of the preeminent Sect.

The pugilist stared at me, and then spoke, "To that young hero over there, I observe that you have the bone structure of a martial arts genius which is only seen once every 1000 years ! It will be a pity if you do not practice martial arts and uphold justice ! Let me transfer all my skills and internal power to you !!!".

After speaking, he grabbed me, and transferred his internal power to me. After the process was complete, the man laughed loudly, and said, "Now I have transferred all my internal power to you ! Don't underestimate this power, for I myself received all the internal power of my master, who received all the internal power of his master !!! You are now very powerful, powerful enough to defeat 2 pugilists !"

I remarked that 2 was a seemingly low number for the combined internal power of 3 generations of experts. Perhaps they were quite lousy in combat. That would also explain why they were beggars.

The master sighed, shaking his head. "You do not understand, young hero. The power transference skill is not perfect ! As power transference goes against the natural laws of the world, only 50% of the internal power is transfered, and the rest wasted ! Hence, even though power transference is an amazing skill, ultimately the maximum power attainable has an upper ceiling."

"Consider a pugilist of generation n + 1. Assuming that he is an average pugilist, his total power, X(n+1), will be X(n+1) = 1 + r * X(n), where r is the percentage of internal power transferred. For the pugilist of generation n, his power is X(n) = 1 + r * X(n-1).

Hence, the power of the pugilist in generation n + 1 is:
X(n+1) = r * ( 1 + r * X(n -1)) + 1 = (r^2) X(n-1) + r + 1

Continuing the process until the original pugilist, X(0),
X(n+1) = (r^(n+1))*X(0) + (1-r^(n+2))/(1-r)
Assuming that there are many many generations, or n large, and since r less than 1, hence,
X(n+1) = 1 / (1-r)
Since my Sect's energy transference skill transfers power at 50% loss, the power of a pugilist (assuming he trains) is 2 !"

After explaining the situation to me, the pugilist fell over and died. I was slightly saddened, since I had lost a comrade in upholding justice.

Not all was lost, however. I discovered a secret manual hidden in his rags. The manual was titled, "First Divine Skill Under Heaven", which arguably meant that it was either the most powerful skill in the world, or (inclusive or) that it was the most primitive skill in the world.

In order to ensure that everyone is also able to uphold justice, I'm sharing part of the manual here.

Manual for the First Divine Skill Under Heaven



Note : I really think that for power transference skills, there should be an attenuation factor, otherwise everyone would be extremely powerful after a few generations.

Friday, April 25, 2008

Secret Research Project 1: Interesting Facts

Now that the research report has been completed and submitted, I have some time to share some interesting facts about the research.

  1. When people ask what I do for my secret research, I say I download images of apples, bananas, irons, scientific calculators, suitcases, crayons, dustbins, pears, plastic bottles, tissue boxes, forks, spoons, laptops, clocks, pillows and blenders.
  2. I now possess a large collection of images of apples, bananas, irons, scientific calculators, suitcases, crayons, dustbins, pears, plastic bottles, tissue boxes, forks, spoons, laptops, clocks, pillows and blenders. Much time was spent to collect and download these images.
  3. For the preliminary versions of the classifier, the classifier achieved a classification rate of 70%. Coincidentally, the training set consisted of 70% natural images and 30% synthetic images.
  4. For the uninformed, point 3 was a consequence of the classifier labeling everything as a natural image, hence achieving a 70% performance. This approach is excellent. By increasing the set of natural images to 99%, the performance can be boosted to 99% !
  5. Point 4 was a joke.
  6. The trusty Microsoft Paint was used to perform many tasks for the project. These tasks include converting GIF, PNG, and BMP images into JPEG format, and creating diagrams for the final report.
  7. Two computers were used for the project. The project could be run exclusively on either the desktop or the laptop computer, but using two computers greatly increase rate of work.
  8. The increase in rate of work was not due to being able to run multiple simulations simultaneously. Rather, the simulations were mostly done on one computer (the laptop), while the other (the desktop) was used for net research and report writing. Useful work was done on the desktop while the MATLAB program ran on the laptop.
  9. Using two computers was also cool for report writing. All the data and related papers were displayed on the laptop screen, while the desktop ran only Word. Information could be directly read from the laptop and entered into the report without ALT-TABBING and changing windows constantly.
  10. I want a dual monitor setup after learning the advantages of point 9.
  11. I want a dual core system to be able to run my (hypothetical) dual monitor system properly without lagging. This is also to make running simulations less of a pain.
  12. MATLAB should perform some checks on code integrity before running. Many times, MATLAB would return an error after it had run much of the simulation processing. The error was a simple formatting error located at the last few lines of the code.
More information on the image classifier will be released if anyone is interested.

Thursday, April 24, 2008

Secret Research Project 1: Quick Update

I'm just dropping by to release some of the latest results for the graphics classifier.

Classifier

SR

NR

AR

Time Taken

C1

85.44 %

69.86 %

77.65 %

37.4 s

C2

87.67%

72.69 %

80.14 %

38.2 s

C3

86.95 %

74.51 %

80.73 %

38.5 s

C4

86.00 %

76.21 %

81.11 %

38.4 s


Notes:
SR, NR = Recall rates for synthetic and natural images. AR = average recall rate.
C1~C4 are classifiers employing some set of metrics.

I'm going to sleep soon. The only reason I'm awake at this hour is to finish my research report, which is now at 37 pages. I'm still missing the discussion and conclusion chapters, as well as a third of the introduction. Work also has to be done on the formatting of the report.

I'm hoping I can mop up the remaining work by noon tomorrow later, since I still have another secret research report to complete by Friday.

I'll release more information and results on the Synthetic and Natural Image Classifier (that's the official name of the thingy) when I'm extremely free. That would be next Tuesday.

[25/04/08] Errors in the calculations were found and corrected.