SPS, SPGS, LU, G&L Trip to Florida

August 5, 2010

I’m back from an exhausting, exhilarating and grossly exercise-deficient 9-day trip to Florida. This was originally meant as a school physics trip (much like the ‘physics trip’ to Thorpe Park…) to see the penultimate shuttle launch. Sadly the launch was delayed to November, and the rocket launch that was supposed to have replaced the shuttle launch also didn’t happen in the end. Fortunately, it is very difficult to go to FL and get bored, so we had a pretty packed schedule. For me it was one heck of a trip for several reasons, but mainly because there were about 100 other like-minded secondary school students on the trip, and also because it was the first time I’ve been to the US since I was born (I left CA, where I was born, when I was a toddler so everything was new to me) In brief, and in pictures (click any pic to embiggen, or click here to see them all):

Scary

Day 0 – Flight in

We had dinner at Ponderosa, a buffet where, as Matthew put it, we ate so much that we became sad afterwards. Presumably a combination of feeling ill and sleepy, or some sort of shock from having eaten so much oil.

Sunset combined with the East Coast clouds is beautiful. The photo, taken through a double-glazed window, really doesn't do it justice at all.

Day 1 – Baseball, Beach

We were taken to watch a baseball match in the morning. It was something like the national U16′s baseball final, and I didn’t find it hugely entertaining; compared to cricket, the batsman seems to miss most of the time and I seem to remember points (runs?) were scored extremely infrequently.

This is a freakily timed shot - I think the ball itself appears between the legs of the fielder (!)

We spent the afternoon at Cocoa Beach. There wasn’t a trace of any oil, presumably because some poor team of people is paid to somehow keep it at bay by trawling, scraping or shovelling the black mess someplace else, so we got the famous golden sand + glistening ocean experience. Which was pretty cool :)

Pelicans sometimes dive-bomb the water to get fish. They're awesome that way.

Day 2 – Universal Studios

Florida’s famous for its theme parks, so we spent the day at Universal Studios. I was surprised by the amount of care, effort and cash pumped into the actual theming of the rides. I found the Simpsons ride unreasonably effective; it was effectively a glorified ’4D’ (I hate that name…) experience, but by adjusting the tilt and roll of the entire platform to provide a ‘g-force’ direction and having screen practically surrounding the riders (I’d say at least 2 pi steradians), some really incredible effects were achieved.

I can't remember this beast's name. But it was extremely fun, even though there were no inversions.

The universe revolves around me...

We dined at Hard Rock Cafe which was apparently really good, but some of us, me included, were still full at the time (burgers for lunch etc.) that we didn’t eat anything (dinner was ridiculously early; at 4:30)…

Day 3 – Kennedy Space Centre; Lunch with an Astronaut

We explored the KSC Visitor Centre in the morning and did the shuttle launch experience, which I thought was an impressively well-designed piece of kit; they even used the lumbar to give the impression of forward acceleration (relative to the rider’s frame of reference). We then had ‘lunch with an astronaut’ which actually just meant a really tasty lunch during which an astronaut appeared, gave a talk, took some questions and offered photo ops. I had the distinct impression he had been asked to dumb down his talk as much as possible – he answered almost all the questions as if reading from a simple.wikipedia.org page printed in Comic Sans. He did quote an equation which he claimed was related to Kepler but which we had never heard of before, and when we asked him about it he implied Kepler had derived it using linear regression on Tycho Brahe’s data, which could have described any of Kepler’s laws. I suspect it was derived from his laws and energy considerations but seeing as nobody could remember the equation afterwards I decided to drop the matter.

The VAB: the world's second largest building by volume, and it has its own weather...

Day 4 – KSC; Astronaut Training

I wasn’t really sure what to expect from this day but I was actually pretty pleased with how it all panned out. There were some great displays and tours including old space equipment with accompanying stories (corned beef springs to mind), there were live demonstrations of the heat-proofing tiling material used on the orbiter and the hygroscopic powder used in the space toilets (sodium polyacrylate). We did a role-playing exercise of operating the shuttle on a mission, and of course we each had goes in the astronaut gyro things. The organisers were friendly and I thought it was a thoroughly worthwhile day.

Day 5 – Free day at KSC

The centre is actually really massive, including up-close coach tours to the launch sites and the legendary VAB (the Vehicle Assembly Building, which is allegedly so big that rainclouds form inside it). We were told about the ‘twang’ (the brief tipping forward of the entire shuttle before takeoff when the main engines are turned on), the difference between the orbiter (the plane-like thing) and the shuttle (the entire orbiter + external tank + boosters system), and the stages of shuttle launch (which I honestly can’t remember. SRBSep [Solid Rocket Booster Separation] and ETSep [External Tank Separation] happen in that order, I think…), and even had wildlife pointed out to us (including a truly enormous bald eagle nest that’s been around for almost 50 years). Apparently there are something like 320 species of bird on the complex.

Full-scale model of the Saturn V rocket. It's MASSIVE!

Day 6 – Island Adventure Theme Park

More theme parks! All I’ll say is that Harry Potter Land was unbelievably crowded (45 mins queue to get into a shop), butterbeer tastes like Dr Pepper with a 0.5cm thick layer of vanilla cream on top, and Duelling Dragons is probably the most impressively designed ride I’ve ever been on – the timing and closeness of the near-collisions are truly incredible, and the density of twists and turns made me lose track of the true direction of ‘up’, which has never happened to me on any other ride (and I’ve been on quite a few).

The Hulk. Great ride, pulled some pretty big gs

Harry Potter Land - beautifully themed.

Day 7 – Airboating

Airboats are simply awesome vehicles. They are capable of going into (basically) a drift at top speed without the least bit of instability, and you stop by turning them 180° and turning up the fans while going backwards. We managed to snap a load of wildlife with some helpful pointers from the driver.

These go incredibly quickly and have scarily good stability. They're like hovercrafts, but *much* better.


You can just about see a bald eagle near the top right of the tree

I have no idea why this didn't blur or be focussed on the wrong thing (like my camera usually does)

We also visited the mall, which was almost entirely clothes, shoes, jewelry and food, as expected…

Miscellaneous Observations

Lots of the stuff I was told about the US and/or Florida actually turned out to be spectacularly true. The cars are, almost without exception, enormous. Most parking lots are easily 0.5m wider than in the UK. People are generally friendly, happy and Anglophilic (it was also the first time I’d come across a customs person who smiled at me). The food portions are ludicrous, leading to the unmitigated and undeniable crassulence of an alarming proportion of the people. And the skies are just beautiful.

A beautiful and bizarrely radiating-patterned sunset

For some reason there's something beautiful about the skies in Florida. Most of the time, every type of cloud, from cumulostratus to cumulonimbus to cirrus is represented.

P.S. Interestingly, I actually managed to lose 1 lb. Go figure.


SPS Walking Trip 2010 – Skye

July 12, 2010

I’m back from my last ever school walking trip, a week of hill walking, this year on Skye, which is supposed to be one of the best places for hiking in the UK. Despite being an island just off the west coast of Scotland, its highest peak (Sgurr Alasdair) is taller than the tallest mountain in England! Needless to say, I’ve snapped plenty of photos.

In brief: it was mostly rainy except for the last day, on which we climbed Sgurr nan Gillean which was the most prominent peak viewable from Sligachan Lodge (where we were staying), though it was only actually visible on the last two days of our stay owing to mist and rain! On all the other days we did shorter walks, persevering despite the showers and wind.

Sgurr nan Gillean (left), Am Basteir and Bruach na Frithe (right), seen from Sligachan Lodge

Wildlife

Surprisingly enough, despite being sparsely forested owing to the weather, Skye has a cornucopia of wildlife, including a couple of golden eagles which we spotted soaring hundreds of metres above our heads. Bird photography is incredibly difficult and I resorted to looking through my DSLR’s EVF with one eye and following the bird with the other, making tracking flying objects possible. We also spotted a few seals and even a whale at one point! Sadly I was unable to get a shot of the whale, as it was too far away and even with 10x optical zoom my photo may as well have been of a wave. Probably the best wildlife we saw was on the way back from Skye when we stopped near Loch Lomond for leg stretching and saw a bird’s nest in the roof of a building, at arm’s reach!

A golden eagle soaring above us. My camera's collecting lens is too small to give a clear shot of fast-moving objects at such zoom

I was really lucky with my timing to catch this seagull landing

Bird's nest in the rafters of a building near Loch Lomond. Awww :)

A seal sticking his head out of the water

A robin near to Loch Lomond

Nature

On our descent on the last day we came across an enormous boulder sitting in the middle of the path, either deposited by a glacier or dislodged from the mountain above. Like most other rocks in the area, it was gabbro rock, a plutonic (slowly solidified igneous) rock with lots of crystals (largely quartz), making it ideal for rock climbing. Of course, we couldn’t resist! Since it was only a couple of metres high the hardest route up I could find was something like a V0, though lots of crimping and palming was necessary and the harshness of the rocks shredded our hands.

Gabbro boulder. Even with a sit start the hardest route was probably only a V0

What a climber's hands should look like!

We also spotted a halo rainbow around the sun. These are different from normal rainbows as they appear when the observer is facing, rather than facing away from, the sun. The colours are also reversed – red is on the inside of the ring rather than on the outside.

Halo around the sun ('sunbow'). Not technically a rainbow.

Miscellany

We found a spent bullet case on the path, marked as a .270 Winchester round, used extensively for hunting, though apparently Skye was once used for military training.

Spent bullet case

Bullet case markings: '.270 WIN'. The markings on the top of the rim look like Russian letters

Evenings were dedicated to film watching, eating and general procrastination. We watched Stardust which was partly filmed on Skye, frequently recognising paths we had walked and landscapes we had admired on the walks. And since we were in Scotland, a haggis for dinner was obligatory!

Where we were

Where the Stardust film crew were


This year in retrospect

June 30, 2010

Caution: [abnormally] high levels of egocentricity are present in this blog post and it’s therefore probably not of interest to anyone but myself :P

My last set of secondary school exams

Academics

In approximate descending order of success:

Computing

Despite doing this outside the timetable, I feel computing has been my greatest success this year. I learnt the entire syllabus over the course of a day from a book and managed to do every question on the paper (the proportion of my answers that were correct is a whole different matter), became the lead developer of Firefly’s secondary product and used that work for the A2 computing project, did some really cool (theory-based) personal projects (1, 2), was invited to the next round of the British Informatics Olympiad (which I unwillingly turned down for Chemistry) and got a Google internship offer (which I was also forced unwillingly to reject by time constraints).

Physics

The olympiad was a complete disaster, but I had the best physics teacher in the world teaching me (CAPS), and in terms of learning stuff and inspiration, this has by far been my best year for Physics. The sheer amount, level and depth of material we went through this year is incredible. And I now have a beautiful, high-quality set of notes which I will probably be using as reference material throughout my university course and beyond.

Chemistry

I’ve discovered I’m frankly hopeless at this subject – especially the organic side – but by some freak accident managed to get into the second round of the chemistry olympiad. So apart from one success, it’s not been a great year.

Maths

Maths has been an unmitigated disaster for me this year. I attained a ‘certificate of participation’ in the *first* round of the UKMT, needless to say not progressing to BMO. I seem to have got even worse at mental arithmetic and my inability to complete any of the STEP 3 questions from this year is a fitting end to my ‘career’ (as TCIM put it) in the subject.

Academics dash (mathmos will get this)

Work aside, it’s been a fantastic year. In the first term I revived my interest in sailing by taking the games half. I also started juggling again, made some youtube vids, shifted my bouldering red point from V0 to V4 and onsighted a couple of V3s, co-developed universityinterviews.com (and am collaborating on something else with the same developer), finally started on Bach’s Ciaconne (from the second partita for solo violin in Dmin), performed the 2nd mvt of the Franck Sonata, made a piano arrangement of Bohemian Rhapsody, picked up scottish dancing, ceroc and catapulting (with a Barnett Black Widow), and discovered the wonders of G&T and tweed. It’s a fitting end to my time at St Paul’s and hopefully a taste of years to come!

EDIT: Oh yeah, and I also met Jimmy Wales and Tim Hunt :P

Summer

I’ll be hiking in the Skye Mountains (the furthest north I’ll have ever been), driving to Spain with my parents, doing some more work for Firefly, going to Florida to watch a NASA rocket launch (hopefully), travelling even further north to Norway to launch a CanSat, then finally flying to Stanford to start a new life (kinda). I’m really looking forward to all that; it should be an amazing summer and I’ll probably wear out the shutter button on my camera :)

Pax


Magnetic Breakfast Cereal

June 8, 2010

According to Brainiac S01E03, cereal is magnetic. According to Wikipedia, iron is added to breakfast cereal as a dietary supplement in the form of elemental iron powder. I couldn’t resist trying it out for myself, and it’s true (see video below)!

Further, this iron can be extracted by grinding the cereal, adding the resultant powder to water to dissolve small saccharides etc that might be trapping the iron in the cereal, and then using a magnet to pick up particles of iron. Supposedly this iron reacts with HCl in the stomach to form soluble iron salts that can be absorbed into the body.


Exam Rant

May 19, 2010

I’m about to sit my last ever batch of secondary school exams (A2 modules), so it’s past paper season and a rant is called for.

In fact, I’m generally happy with the exams that we’re sitting. The Maths syllabus and exams are interesting and cover extremely useful and interesting topics, particularly differential equations and a massive amount of Newtonian mechanics, with some quasi-Lagrangian stuff thrown in at M4; my only major qualms are that the course is weak on linear algebra (a personal interest) and contains nothing on vector calculus, an enormous topic which would have been enormously useful for getting a handle on understanding the extra-curricular physics and fluid dynamics we were shown in lessons (rather than just commenting on the shapes of the symbols). Most importantly the exams do the subject justice; for the further maths modules, it is necessary to be proficient at the subject to do well, which, from my experience so far, for UK exams based on the national curriculum, is almost unique. And of course there’s always STEP which I fail at due to lack of ability rather than lack of exam technique which suggests it’s a good exam.

Physics and computing are similar; the exams are mathematical, quantitative and logical in nature, requiring few wordy answers, of which almost all are worth few marks and have entirely reasonable mark schemes. Though CAPS has been giving us questions from past A level and Oxbridge physics papers throughout the year, and not only are the questions from those demanding – both mathematically and conceptually – but they are also genuinely interesting and by doing them, candidates develop a deep understanding of aspects of some of the topics involved; the rainbow made beautiful in the style of Lilley’s ‘Discovering Relativity for Yourself’ – through working out the answers to a series of exquisitely well-thought-out questions. The current physics exams are almost entirely uninteresting slogs in comparison, though still good.

And now we come to chemistry, and the body of my rant. Perhaps I’m simply biased because I’m not a good chemist in the first place (or at least I’m even worse at chemistry than I am at all my other subjects). Or maybe I just want to blame the fact that I scored a low B on both chemistry mocks on something (which is by today’s standards terrible; according to CAPS last time a C was a perfectly respectable grade owing to the difficulty of the exams). Either way, I maintain that it isn’t entirely my fault that my marks are atrocious (though I concede that it is to a large extent).

It’s an old and possibly overused complaint that mark schemes / exams are badly written, and is consequently often taken lightly. Unfortunately I really do think think it’s gotten to such a stage that the Monster Raving Loony Party’s idea about education wouldn’t be that much worse than how it is currently: “It is proposed that, before the beginning of exams, the exam board will select a certain obscure phrase which will be kept secret. If any pupil inadvertently writes this phrase in any exam, he/she will automatically receive straight A* grades, and a free teddy.”

I’ll cite what I think are some of the worst examples of chemistry exam madness:
1. The mark scheme insisted that one E0 value was ‘more positive than’ another, but specifically rejected ‘greater than’.
2. To obtain the mark for one question, it was necessary to specify movement of *electron* lone pairs, not just lone pairs. Though personally I’ve never heard of lone pairs of anything other than electrons in any context.
3. The ‘Quality of Written Communication’ (QWC) mark is normally awarded for writing ‘two complete sentences’. But if you write a single long complicated sentence containing many subclauses with impeccable grammar that conveys meaning effectively and efficiently, you wouldn’t get that mark. Also, why on earth is grammar being tested in a chemistry exam? And more importantly, why does the government (or whoever it is whose fault this is) deem it necessary to test the ability of 18 year olds to construct cogent sentences!? (I admit my proficiency at written and spoken English is evidently imperfect but even the stuff I write makes sense. Doesn’t it? DOESN’T IT?)
4. Displayed formulae. Nobody uses them. Ever. Everything is skeletal. Also, the OH group is a single atom and should always be depicted as one…
5. Questions like “Discuss isomerism in complex ions” for 12 marks. They invariably have a really tight accompanying mark scheme with exactly 12 scoring points. One could conceivably (and entirely legitimately given the vagueness of the question) write an engaging paper on group theory or electronic orbitals in response and only receive the single QWC mark…

Allow me at this stage to cite Bill Watterson.

This image was taken from a fantastic blog post which more or less summarises why I love Calvin & Hobbes. Anyways, suffice it say Calvin’s words, “You’ve taught me nothing except how to cynically manipulate the system”, form an accurate representation of the national curriculum: learn answers to questions, rather than be educated.

But maybe all this is good preparation for the real world after all. Today I sat the ‘Life in the UK test’, one of the critical stages on the way to becoming a British citizen (apparently wearing tweed, drinking G&T and occasional Scottish dancing isn’t enough; trust me, I asked), for which I had to study (read: flick through Schott’s half an hour before leaving). And it can mostly be frankly and truthfully summarised as b/s: memorising dates (e.g. the precise year women were first allowed to divorce their husbands [1857 or something]), statistics and numbers (some of which as obscure and inconsequential as the percentage of Christians in the UK who are Roman Catholic [10%], some of which are required to be known to an unreasonable degree of accuracy such as the percentage of the UK’s population that is Muslim to 2sf [2.7% as of a few years ago, probably now different], and some of which don’t even make sense such as the coastline of Britain [infinite by my {and Mandelbrot's} reckoning but that wasn't an option]), and mundane facts (e.g. that 1941 was the only year the UK didn’t have a census). They might as well have asked ‘who put Gordon with the bigoted woman?’ [definitely Sue]. There was also what might be described as ‘jack all’ about geography, particularly mountains and weather, information which I personally consider much more central to Britain than the ethnicity of the bus drivers employed in the 1950′s [West Indies and Carribbean] (or even important things like the number of seats in the Commons).

So it seems that even after the horrors of OCR (“Recognising Achievement”) are over, life continues to be dominated by ‘cynically manipulating the system’; learning useless facts or effecting pointless tasks to satisfy some criterion for something really important. I guess that’s just what life is about and I’ll have to learn to live with it, willingly or not; if you can’t fight it, join it. Sucks to be human…

Anyways, rant over, and it’ll probably be the last before the end of June when my exams end…


My Google Saga

April 30, 2010

Google is an amazing place to work; they have the best projects, employ the best people and have the best decor. In fact I was at Google HQ in London at the end of last summer for Young Rewired State, a hack day for 15-18 year olds, and we even got food with Google logos on it! So I applied earlier this term for a summer job / internship / work experience (how synonymous are these terms anyway?) at Google HQ at Mountain View, CA.

There’s a great deal of mystery surrounding the Google selection process, but having gone through Cambridge and Stanford applications, from my point of view it wasn’t anywhere near as baffling. It was made clear what qualities are expected of candidates (I inferred that these are primarily programming and algorithmic fluency and an interest in at least one of the company’s projects), the decision process at Google’s end was surprising in speed (a weekend) and Google made sure to keep paperwork to a minimum (a mere few PDFs); more than I can say for any of my university applications!

The process was also pretty simple in comparison. Since, from what I can tell, Google normally only recruit interns from the pool of compsci students currently attending university and I’m still at secondary school, I had to contact them directly via email (with the help of a contact) to get started. I was bounced around a bit and sent my CV and cover letter to a number of different departments until I was given instructions to fill in some application forms. A couple of days afterwards I received an email informing me Google want to interview me (technical interviews) and requesting a list of dates and times I’m available. Just over two weeks later I got a reply informing me I had two interviews at 10 and 11 pm GMT (!) with some links to advice about what to brush up on. Google technical interviews are conducted by phone from the US with the help of Google Docs (interviewees code directly into the google doc – no IDE / debugger!) and are entirely about algorithms and programming. From what I read leading up to my interviews, data structures (esp. linked lists and binary trees) come up in pretty much every interview. C++ seems to be the language of choice of most Googlers, though I was allowed to use C# (whose syntax pretty much identical to C++ anyway and almost literally identical to java) when I admitted that I’m crap with pointers :P. I’m not at liberty to disclose interview details, but to cut a long story short I did a few retarded things and failed an algorithm question but was complimented on my speed of coding in both interviews.

Of course, it wasn’t over yet. “I have good news for you.” quoth an email that arrived days later. They wanted to move forward with the next step and identify a project (including a further interview), and warned that there are no guarantees. As it turned out, I got the job after this (non-technical) interview with the potential project manager but didn’t have the mandatory 11 weeks’ contiguous holiday to spare, and consequently had to (very reluctantly) turn down the offer – accepting would have meant missing hiking in the Skye Mountains, watching the penultimate NASA space shuttle launch in Florida and launching a CanSat from the Andoya Rocket Range in Norway (Skye and Norway being the furthest North I’ll have ever gone).

But anyways, I’ve now survived literally the two toughest interviews of my life (I definitely struggled a lot more with these than my Cambridge ones – but then I’m a bit crap at inventing clever algorithms and know nothing compared to an actual compsci student) and I’ll have a better idea of what to expect next time when I apply again next summer!


British Chemistry Olympiad Round 2

March 29, 2010

It’s been a pretty epic weekend. Keeping it brief:

Friday: Journey to Cambridge

I actually went up with a friend who was going to the Informatics Olympiad (BIO2) to which I had been invited but clashed (to the hour) with the chemistry one – I chose chemistry as I did BIO2 last year and sought variety. After my customary meal at Wagamama I dropped my stuff at St Cats (where BChO2 was to be held) and started wandering round Cambridge. When I got back I met up with some of the people from last Summer’s training week who had made it to round 2 this year. We were all standing around in a circle when the inevitable titration jokes started <- actually true ;)

All 20 of us were taken out to dinner at Pizza Express by the olympiad committee (which itself consisted of over 10 members), an event which lasted about four hours due to slowness of cooking / service (…) but was great fun. We planned the pub trip for the next day and went to bed with the knowledge that we would wake up to six hours of chemistry.

A curious tradition of the olympiad, enforced to prevent bias, is for each person to be randomly assigned an element as a pseudonym and for us to use those throughout the competition for written work. I was Phosphorus, which I think I might have spelt wrong…

Saturday: The hardest exam I have done / will ever do

There was a practical exam in the morning which I had been dreading slightly owing to my invariably highly chaotic past lab experiences. As it turns out there was nothing impossibly demanding that we had to do and I managed not to emerge awash with pyridine / phenol / some other nasty reagent, and we all did a TLC, learning on the job, which was completely new to me and cool to do; they seemed to like my TLC plate (woo!). I was really impressed with the facilities (in comparison to St Paul’s anyways – to me having a fume hood each is a luxury) though it was impossible to tap whiz the burettes (an invention of NAL: turning the burette tap 180° letting through about 0.5 cm3)! I even managed to get excited about the pipette fillers (get me…) – squeezy rubber things that suck automatically with virtually no effort on the experimentalist’s part, rather than the really annoying cylindrical plastic ones we get at school that you have to crank with your thumb and never work / fit. It was also the first time I’d ever worn a lab coat.

We had been promised that we would sit a particularly difficult theoretical paper, and it was revealed just before we started that it was in fact the hardest paper they had ever set. Being the worst organic chemist you’ll ever meet, I think I just about managed to get through the ones that would have looked plausible in a physics paper and drew some structures for the organic questions that would certainly have made my teachers cry from despair (if not laughter)…

Walking dazedly through the streets of Cambridge and making conscious and desperate attempts not to talk about anything related to electron movement, we filed into a pub. At some point there was a formal dinner where we each got a glass of each of three different wines, including a rather exquisite dessert wine which was discussed in great detail in terms of aldehydes, esters and hexane (…)

The rest of the evening can probably be found on Facebook.

Chemists are good fun

Sunday: The aftermath

We basically got sat in a room after breakfast, got given goodie bags (including RSC Sigg bottles, a book of Chemistry cryptic crosswords, scientist-shaped memory sticks, safety specs, and a T-shirt) and certificates, and the team was announced. Congrats to those who got in, especially to David Edey for having got through while still in the year below!

It goes without saying that I didn’t get through, but it was an enjoyable weekend and I met some awesome people (who I will be seeing next year)!

Pax


Group table completion program

March 5, 2010

The Further Maths syllabus incorporates group theory, a fairly useful but abstract concept. It’s all very interesting and somewhat reminiscent of our semi-formal introduction to set theory and functions with GL last year. Unfortunately, interesting as groups may be, exam questions can ask you to fill out a group table, a task whose tedium is comparable with plotting graphs with pen and paper. While completing a group table in class, after remarking that it’s somewhat similar to doing a SuDoku (each element appears exactly once in each column and row), I pointed out writing a computer program to do this would be interesting and much more fulfilling than bashing through a group table completion. And that’s exactly what I did.

The code is fairly self-explanatory but probably full of bad habits and other rubbish; the only reason I’m making a blog post about it is because it’s the first time I’ve ever implemented (albeit quite messily) a Breadth-First-Search-type algorithm for a vaguely realistic problem, making it particularly interesting (to me).

The algorithm for finding the value for a cell (derived from elements i and j, e.g. ij if the group is multiplicative) is basically this, in really loose structured English:

Concatenate i, j. Call this concatenation c.
Look up if c is an element of the group.
If so, done.
   Set c as the table’s value at (i,j).
Else: Add this expression to a previously empty list.
   Repeatedly:
      For each expression in the list:
         Find character sequences which can be simplified by examining the existing table
         For each of these simplifications
            Add the mono-simplified expression (simplified once) to the end of the list
            If this simplification is an element of the group, we’re done.
         Remove the expression from the list

In other words the simplification algorithm systematically takes the expression, finds lots of equivalent expressions (by looking up simplifications in the half-completed group table) and chooses the equivalent expression that happens to be an element of the group. This obviously requires closure, or the algorithm will keep searching forever and never complete. For this reason I implemented a counter-measure to infinite runtime – it’s a bit of a hack but hey…

The program prompts for input. The first line is N, the number of elements in the group. The next N lines are string representations of the elements, e.g. a, aa, ab, bba etc. The next N^2 lines are the existing table – the program needs something to start with to simplify anything.

Here’s my example test data:

6
e
a
aa
b
ab
aab
e
a
aa
b
ab
aab
a
-
e
aab
-
-
aa
e
-
ab
-
-
b
-
-
e
-
-
ab
-
-
-
-
-
aab
-
-
-
-
-

This represents the following group table:

e   a   aa  b   ab  aab
a   -   e   aab -   -
aa  e   -   ab  -   -
b   -   -   e   -   -
ab  -   -   -   -   -
aab -   -   -   -   -

The program’s output is:

e   a   aa  b   ab  aab
a   aa  e   aab b   ab
aa  e   a   ab  aab b
b   ab  aab e   a   aa
ab  aab b   aa  e   a
aab b   ab  a   aa  e

Incidentally this is (hopefully) the answer to one of the questions set for this week’s homework.

Here’s the C#.NET code:

using System;
using System.Collections;
using System.Linq;
using System.Text;

namespace Groups
{
    class Program
    {
        public static string[] elements;
        public static int[,] table;
        public static int N;
        public static int depth;
        public static ArrayList simplifications = new ArrayList();

        static void Main(string[] args)
        {
            Console.WriteLine("Size of group");
            N = Convert.ToInt32(Console.ReadLine());

            elements = new string[N];
            Console.WriteLine("Group elements");
            for (int n = 0; n < N; n++) elements[n] = Console.ReadLine();

            table = new int[N,N];
            Console.WriteLine("Existing group table:");
            for (int j = 0; j < N; j++)
            {
                Console.WriteLine("row " + j.ToString());
                for (int i = 0; i < N; i++)
                    table[i, j] = str2index(Console.ReadLine());
            }

            PrintTable();

            while (true)
            {
                Console.ReadKey();

                FillTable();
                PrintTable();
            }
        }

        public static void PrintTable()
        {
            for (int j = 0; j < N; j++)
            {
                Console.WriteLine();
                for (int i = 0; i < N; i++)
                {
                    if (table[i, j] == -1) Console.Write("-   ");
                    else
                    {
                        Console.Write(elements[table[i, j]]);
                        for (int a = 0; a < 4 - elements[table[i, j]].ToString().Length; a++) Console.Write(" ");
                    }
                }
            }
            Console.WriteLine();
        }

        public static void FillTable()
        {
            // for each thing:
                // concatenate strings
                // look up if concatenation is an element. If so, done.
                // else look up from table if part of concatenation simplifies.
                // search through all simplifications until one which is an elment is found

            for (int i = 0; i < N; i++)
            {
                Console.WriteLine("now doing row " + i);
                for (int j = 0; j < N; j++)
                {
                    if (table[i, j] == -1)
                    {
                        string s = elements[i] + elements[j];
                        if (str2index(s) != -1)
                        {
                            table[i, j] = str2index(s);
                        }
                        else
                        {
                            simplifications = new ArrayList();
                            simplifications.Add(s);
                            depth = 0;
                            Simplify();
                            table[i, j] = str2index((string)simplifications[0]);
                        }
                    }
                }
            }

        }

        /// <summary>
        /// Simplifies the single element in simplifications.
        /// When done, will leave a single element simplifications[0] in simplifications.
        /// That will be the simplified string, which is hopefully an element.
        /// Told you it's a messy implementation
        /// </summary>
        public static void Simplify()
        {
            depth++;

            if (depth > 20 || simplifications.Count > 1000)
            {
                simplifications = new ArrayList();
                simplifications.Add("-");
                return;
            }

            int origsize = simplifications.Count;
            Console.WriteLine(origsize);
            string ret = "!";

            for (int q=0; q<origsize; q++)
            {
                string[] simps = simplify((string)simplifications[q]);
                foreach (string t in simps)
                    if (str2index(t) != -1) ret = t;
                foreach (string t in simps)
                {
                    if (!simplifications.Contains(t)) simplifications.Add(t);
                }
            }

            for (int a = 0; a < origsize; a++) simplifications.RemoveAt(0);
            if (ret != "!")
            {
                simplifications = new ArrayList();
                simplifications.Add(ret);
            }
            else Simplify();
        }

        /// <summary>
        /// Finds all single-step simplifications of a string
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public static string[] simplify(string s)
        {
            string[] ret = new string[1000];
            int n = 0;
            for (int startat = 0; startat < s.Length - 1; startat++)
            {
                for (int a = 0; a < N; a++) // first element
                {
                    if (s.Length >= startat + elements[a].Length)
                    {
                        if (s.Substring(startat, elements[a].Length) == elements[a])
                        {
                            for (int b = 0; b < N; b++) // second element
                            {
                                if (s.Length >= startat + elements[a].Length + elements[b].Length)
                                {
                                    if (s.Substring(startat + elements[a].Length, elements[b].Length) == elements[b])
                                    {
                                        if (table[a, b] != -1)
                                        {
                                            ret[n++] = s.Substring(0, startat) +  elements[table[a, b]] + s.Substring(startat + elements[a].Length + elements[b].Length);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            string[] realret = new string[n];
            for (int a = 0; a < n; a++) realret[a] = ret[a];
            return realret;
        }

        public static int str2index(string str)
        {
            for (int a=0; a<elements.Length; a++)
            {
                if (elements[a] == str) return a;
            }
            return -1;
        }
    }
}


Ongoing Projects

February 4, 2010

At the moment, thanks to the post-university interviews honeymoon, I’m involved in some cool projects I’d like to write a bit about.

ESA European CanSat Competition

This is a very interesting competition organised by the European Space Agency and is quite likely the biggest scientific project I have ever undertaken. In brief, each team (consisting of 10 members) has to design a ‘satellite’ (mislabelled in my opinion for this competition) that can perform some interesting and/or useful scientific experiment when dropped from a height of 1km. There are lots of requirements/restrictions, e.g. everything has to fit into a european soda can (hence ‘cansat’) and the budget is limited to 1K Euros (more details here). Needless to say this is immensely exciting for us; we are representing the UK in a massive engineering competition, and are one of only 12 teams in Europe to be chosen to go through with the construction and launch of this thing (at Andøya, in the Arctic Circle on the Norwegian island of Andenes, to which some of our team members will be going[!!]).

Our idea is for our cansat to act as a dropsonde – it will take data which would allow the construction of a wind profile of the descent to enable precise placement of a hypothetical second payload (an idea we got from one of the talks at the Aerospace Competition finals last summer). We have a blog and more details will emerge as time passes (a press release is in the pipeline). You can also follow @cansat_eclipse. We’re also using Google Wave for coordination :)

Homeopathy Investigation

My attention was drawn recently to the 1023 Campaign, a campaign aimed at bringing to public attention the reality of homeopathy: that as far as science is concerned, it’s just water, and apart from the placebo effect is as good at curing diseases as cistern water (which, famously, is potable). As the St Paul’s Sceptical Society, a group of us decided to take part in the 1023 event, a mass homeopathic ‘overdose’ to demonstrate confidence that there’s literally nothing in it. As Paulines we of course missed the date, but instead are planning a serious double-blind test involving pseudo-random number generators and proper statistical analysis and planning to investigate the effect of homeopathic coffee on drowsiness. We wanted to do a Wilcoxon test but we think in the end we’ll just go for a t distribution based investigation, which assumes a normal distribution but seems to be well-respected in the scientific world. This is an important project for me since it will be the first real scientific investigation I’ve been involved in, and especially since it’s both topical and sceptical in nature, I’m looking forward to seeing some results.

UniversityInterviews.com

This project started some time ago but I never got round to blogging about it. When the university interview madness began last term, a friend and I had the idea of building a site for people to share their interview experiences, and this is the result. I’m quite pleased with what we’ve made and I hope to see it being well-used in years to come.


Juggling

January 31, 2010

My slightly random interest in juggling seems to have been revived recently by Stewart Brand who came to my school to give a talk on environmentalism and started off by showing the rather famous clip of Chris Bliss’ juggling finale (Golden Slumbers). Juggling might seem like a completely irrelevant and useless “skill”, and in many respects it is. But it seems like most of the people I know who juggle reasonably well are scientists or mathematicians (head of physics at my school, a biology teacher at my school, some guy on a poster in my maths teacher’ classroom), and there appear to be lots of fascinating parallels between juggling and maths. So in a way juggling is a unique activity combining skill, dexterity, coordination and performance with an intellectual allure irresistible to scientists and mathematicians … and for the sake of some hilarity I’ve made a Youtube vid!

Order:
1. Cascade, MM, BM, RR
2. Cascade, BB, MM, BM, MM, RR, (near drop), RR, Cascade, BB, MM, BM
3. Box
4. Improvisation

MM = Mills Mess BM = Boston Mess BB = Burke’s Barrage RR = Rubenstein’s Revenge

Siteswap notation

There’s a pretty good article explaining what this is here that also investigates the maths of juggling; it’s basically a way of writing a juggling pattern that has mathematical curiosity.


Follow

Get every new post delivered to your Inbox.