Stopping Distance for UK Driving Test

One of the exams that must be passed for a UK driving licence is driving theory. This is a series of multiple choice questions. Most of them are very obvious, but some questions require knowledge. In particular, the stopping distances for a car travelling at various speeds is required to be known. (In reality, one does not actually need to know the answers as guessing suffices, and so few (if any) questions are asked on it that it is permissible to get them wrong.)

The stopping distance is split into ‘thinking distance’ and ‘braking distance’. The official numbers are as follows:

Speed (mph) Thinking distance (m) Stopping distance (m) Total distance (m)
20 6 6 12
30 9 14 23
40 12 24 36
50 15 38 53
60 18 55 73
70 21 75 96

One interesting thing about these numbers it that the speed is measured in miles per hour, but the stopping distance is in metres. One mile is 1.6 kilometres.

There is no need to memorise these numbers as it is simple to make an approximate formula for them.

The thinking distance should be the speed multiplied by a reaction speed, and this reaction speed should not depend on the speed the car is travelling at. That is, the thinking distance divides by the speed should be a constant. It is, and this constant is 0.3. Thus to calculate the thinking distance, multiply the speed by 0.3. (In practice, one divides the speed by 10 and then multiplies it by three)

For the stopping distance, the force applied by the brakes should not depend (much) on the speed that the car is travelling. Therefore if a(t) represents the acceleration at time t, it should satisfy a(t) = -b, where b is some unknown constant. Integrating, this means v(t) = S-bt, where v(t) represents the velocity at time t, and S is the initial speed. It thus follows that s(t) = St - t^2, where s(t) represents the position of the car at time t. The car stops at time S/b, and so the distance travelled at that point is s(S/b) = S^2/b - S^2/b^2 = S^2( b - 1 )/b^2.

We can solve that equation as a quadratic in b, given the speed S and the actual stopping distance s(S/b). Taking the larger root and trying it on the data points on the table above, we find b is approximately 64 (although it does vary between data points). Thus the stopping distance is \frac{S^2}{64^2} (64-1) \approx \frac{S^2}{64}. This is good because finding a 64th of something is simple, as you can just repeatedly divide by two.

This means that altogether, the total stopping distance in metres is:

0.3S + \frac{S^2}{64}

This gives the following results:

Speed (mph) Actual total distance (m) Predicted total distance (m)
20 12 12.25
30 23 23.06
40 36 37.00
50 53 54.06
60 73 74.25
70 96 97.56

Which is close enough! (Indeed, it exactly gets these points if one divides by S/60 and takes the nearest whole number)

Note that although the equation is very possible to evaluate by hand, it could be easier. If one assumes that you will only be asked about speeds which are a multiple of ten, then you can let S = 10k. Then the equation becomes the following which is much easier to use:

3k + 1.5 k^2

Advertisements

A Bit of Graph Theory

I’ve written a document which explains some basic graph theory. In particular, it poses a few puzzle questions related to planar graphs and then solves them using Euler’s Formula.

I tried to write it in a casual style. The idea was that it should be easy to read whilst not giving up any mathematical accuracy. Actually, I’m not sure the style works at all, but it was worth experimenting.

Thank you to Kris for some suggestions to improve it. A version suitable for A5 booklet printing is available on my website.

graph_preview

Click to view/download

Arithmetic: then and now

The Conservatives recruited Carol Vorderman to head a ‘mathematics task force’ before the election, in 2009. After the election, in August 2011, the ‘task force’ reported (Telegraph article / Original Report). I find it a little bit puzzling that Vorderman was selected for this, as she is neither a teacher nor a mathematician. (She only managed a 3rd in each of her years at Cambridge studying Engineering.) Nevertheless, the bulk of the work was done by Roger Porkess, it appears, who is head of MEI. He is good.

The report has some good points in it. Nevertheless, page 52 is interesting. It shows three exam questions from previous papers, and the following remark:

Our conclusion from looking at the papers from these three years is that O level was harder than what came before or after it. However, a comparison is not entirely fair because GCSE is designed for a very wide range of students: O levels were not. Discussion of the standard of this, or any other, qualification needs to take place in the context of its fitness for purpose. However, there is compelling evidence that grade inflation has occurred.

The questions are as follows:

(In what follows I will answer the questions. This is probably fairly pointless, as if you read this blog you can almost definitely do them yourself.)

I think the 2011 GCSE question is actually pretty good as approximating an expression is a useful, practical skill which is not so mechanical. Presumably, this was a question in an exam without a calculator. (At least when I did the exam, there was a non-calculator exam and a calculator based one.)

If I were to answer the question, I would multiply the fraction 95.9/(0.81\times 0.62) ‘top and bottom’ by 100, and approximate 95.9 as 100, to give 100^2/(8.1\times 6.2). The product in the denominator is then approximately 8\times6 = 48 \approx 50 and thus you get 100\times100/50 = 200, as required.

I consider that a fairly good, practical problem. It’s much shorter than the other two questions, but this can be attributed to a change of style.

The 1971 O Level question is not as good in my opinion. The first part is, I suppose, a test of their understanding of adding fractions. That the whole thing is itself in a fraction is presumably just to make the question seem harder. It shouldn’t really make the question any harder, but I suppose under pressure in an exam it does. The obvious thing to do is to multiply the fraction ‘top and bottom’ by xy. This gives:

\frac{xy}{x+y} = \frac{3 \times 7}{3+7} = \frac{21}{10} = 2.1

The fact the 3 and 7 were chosen, which sums to 10, makes the question easier if it wanted an answer as a decimal expansion. Presumably an answer as a fraction would be acceptable too.

Let us skip the second part for a moment and head to the third. Clearly the values of and q do not matter here, as they are cancelled out. The answer is hence merely 3. If for whatever reason you do not notice this, you have a lot of calculating to do! Nevertheless, it is a simple factorisation and will certainly be tested in more modern exams.

Going back to the second part – it is a pain really. Log tables are the easiest solution within the rules of the exam. Rather than find any particular shortcut, it is easier to ‘just do it’. Find the log of p, double it, anti-log it. Do the same with q. Add the two numbers together. Log it. Half it. Anti-log it. Then we got the answer. It’s boring, and how is it any better than using a calculator? All you are doing is looking some numbers up in a table and occasionally adding or halving them. It’s just a procedure. Perhaps it was useful then, but it isn’t useful now.

The first question, from the 1931 School Certificate, I actually like quite a bit. Let us do the third part first, as it the easiest. It is well known that 1/3 = 0.333…, and that 1/100 = 0.01. Thus 1/200 = 0.005. It follows that:

1/3 - 1/100 - 1/200 = 0.318333\ldots \approx 0.31833

Now let us go back to the first part. We wish to find find the decimal expansion of 7/22. (Note that 22/7 is a popular approximation of pi, which comes from the continued fraction expansion of the number. 7/22 is also the approximation from the first three terms in the continued fraction expansion of 1/pi)

We could just use long division and not think about what we are doing, but I prefer to do these calculations more explicitly. To find the first decimal place of 7/22, we can multiply it by 10 and then take the integer part. This gives 70/22 = 3 + 4/22. Hence it starts 0.3. We then continue with 4/22 – multiply by 10 and take the integer part. This will clearly give the next decimal place. Now 40/22 = 1 + 18/22. Thus the expansion of 7/22 starts 0.31. Continue again: 180/22 = 8 + 4/22. Thus it continues 0.318. We have already seen 4/22, and hence it will yield a sequence continuing 1 then 8 forever. Hence the expansion is 0.318181818…, or 0.31818 to five decimal places.

The second part is unfortunately basically identical, and so is rather dull. We have:

  • 710/223 = 3 + 41/223
  • 410/223 = 1 + 187/223
  • 1870/223 = 8 + 86/223
  • 860/223 = 3 + 191/223
  • 1910/223 = 8 + 126/223
  • 1260/223 = 5 + 145/223

And hence the decimal expansion starts 0.318385, and so is 0.31839 to 5 decimal places.

Therefore our numbers are 0.31818, 0.31839 and 0.31833. The closest to the target number of 0.31831 is thus the third. (What were they playing at! 106/333 is much closer than all of them!)

Perhaps the third part is still useful today, but exactly evaluating the decimal expansions of fractions probably isn’t because of computers. So it is merely more modern.

It’s hard to say really which questions were harder. I didn’t like Part II of the second question as I couldn’t think of an easy way to do it. The other parts of the question were brainless however. The third question was interesting, but the first question was the most interesting, except for Part II which required you to do a load of arithmetic which was almost identical to what you had just done, which is boring. No wonder everybody hates maths.

I don’t have any solid conclusions myself. Indeed, when I was at school I looked through A-Level mathematics exams from the 1960s onwards. I actually thought the hardest papers were in the years 1990-1992. Previous years did not require you to understand anything, but just required you to ‘do’ things which could be learnt without understanding why. Later years were just easy. Happily, the exams I did myself were of the easy variety !

It is often said that people are worse at maths now than previous generations. Perhaps this is true, but I’m not entirely convinced previous generations were any good at it either. For instance, perhaps people who went to score in the 1970s can multiply and divide long integers, but in my experience from having seen people do it, they merely perform an algorithm they have learnt and never understand it. My calculator can do that, and it can do it better. When something goes wrong, they don’t know what they might have done wrong because they don’t know why it works. They might not remember what to do when they encounter a zero, etc.

Perhaps I will try and expand on this subject in future.

Interest in Your Bank Account

Suppose you have £100 and you wish to put it into a savings account for a year, and the interest rate is 5% per annum. What does this mean?

Well, it could mean a few things.

First, it could be that the interest rate is applied at the end of the year. So at the end of the year you get:

\mbox{\textsterling}100 \times 105\% = \mbox{\textsterling}105

However, it could also mean that there is a 2.5% interest rate applied twice in a year:

\mbox{\textsterling}100 \times 102.5\% \times 102.5\% = \mbox{\textsterling}105.06

Earning you a little bit more! Suppose instead that the interest was applied every day:

\mbox{\textsterling}100 \times \left(100\% + \frac{5\%}{365}\right)^{365} = \mbox{\textsterling}105.13

In general, if it is updated h times in a year, with an annual interest rate p, then it is equivalent to the interest being calculated once at a rate of:

\left(1 + \frac{p}{h}\right)^h

So what if it was updated all the time? It is well known that the above expression tends to \exp(p) as h \rightarrow \infty.

The point is just that these things can come up naturally!  This is actually widely used when trading derivatives.

Spellcheck Object Guide

So it seems that nobody is too sure how to use the Spellcheck object. It is a pro-only extension, and it never had a step-by-step tutorial, so here one is. It is based on my post on the Clickteam Forums.

Stage 1: Load a dictionary

Obviously the spell-checker doesn’t work without a dictionary. Luckily, the example pack comes with two dictionaries. We’ll just use the smaller word list for now, but there is a larger one too. The larger dictionary includes some common spelling errors itself as it is based on common search terms, and so is best avoided.

Insert the object into the frame and don’t change anything on the dialog box. Most of these settings are only required for advanced use, and you won’t need any for a while yet.

Now, create a  ‘Start of frame‘ condition and add the Spellcheck action ‘Load Wordlist (Pauses MMF)‘, as shown in the screenshot below:

Choose ‘Smaller Wordlist.nswl‘ as the dictionary, which, as mentioned earlier, can an be downloaded as part of the example pack.

If you run the program, nothing happens. That is because it loads the dictionary, and then does nothing with it. If you are running on a particularly slow computer, or loading the file from a slow location, you might see a delay whilst it loads, but that is it.

We got to make it do something. Hence, stage 2.

  1. ‘NSWL’ stands for ‘Null separated word list‘. This means that each word in the dictionary is separated by a ‘null character’. (ASCII value 0). Words can also be separated by new lines, but as a new line in Windows is 2 characters using null characters saves a little bit of space.
  2. It is also OK to load one dictionary then another, and the object will then have a dictionary with both the details.

Stage 2: Checking if a word is in the dictionary

We can check if a word is in the dictionary by using the ‘Is Word correct?’ condition. So, let us make an edit box with a button which tells us what is the case.

Insert the button and edit box into the frame as you normally would. We wish to make to events: One which fires when the button is clicked and the word in the edit box has been spelled correctly, and the other when it is clicked but is not. For this, we will use the “Is Word Correct?” condition:

Add the condition “On Button Clicked” + “Is [Text of edit box] correct?” and provide some effect, like setting a string to “Is in dictionary”. Then have the same event but with the second condition negated and have it do something like set a string to “Is not in dictionary”. It should look something like this:

Run it and hopefully you will see that, for instance, “Hello” is in the dictionary but “Hellop” is not.

  1. For more advanced use you can load it in the background with the ‘Load Wordlist in Background‘ action and update a progress bar using ‘LoadingPercentage‘ expression, but for now we’ll just let it pause your program whilst it is loading. The frame cannot change before it has finished loading, though! Change the example so that it does it that way.
  2. All Spellcheck objects share the same dictionary, so if you load it on the first frame and use it again on the second, you don’t need to reload it. Test this by loading the dictionary and checking the words in different frames.

Stage 3: Getting suggestions

Now this is not very exciting. However, we can get suggestions using the object. To do this, you get the incorrectly spelt word and pass it to “List Suggestions” action. This doesn’t directly do anything, but it does cause the ‘On Correction Suggestion‘ event to get triggered once per suggestions.

So add a list box, and when an incorrect word is found you should clear the list box it and then call ‘List suggestions’, adding the suggestion to the list each time. Use the ‘Suggestions -> Get Suggestions’ (Suggestion$) expression to get the name of the current suggestion.

Download this as an example here

Tweak the settings on the first page of dialog box to change how the results are returned.

The Next Step

The next step is to spell-check sentences. This is explained in Part II.

The Light Bulb and Tower Problem

A puzzle interview question I was recently asked:

You have two identical light-bulbs. You need to find out how strong they are. There is a 100-floor building and you can drop the light-bulbs out of the window. You know that there is some floor such that it will break, and it will break for all above it, but you don’t know what floor that is. It will never break for anything less than that floor.

Find the method of doing this such that the worst-case is as small as possible.

Obviously it is possible to just start at floor 1 and go up until you find it. The worst case then is 100 drops, which is pretty poor. An improvement on that is to go up every other floor, using the second light-bulb to work out which floor it was when it breaks. That gives a worst case of 51 drops.

This can be generalised to stepping up N floors each time. Then the worst case would be:

This function can easily be minimised by taking its derivative and seeing where it is 0. This method gives N = 10, suggesting you should go up every 10th step. The worst case is floor 99, which takes 19 drops.

But if it took 19 drops worst case, why did we bother starting on floor 10? If we started on floor 19 we wouldn’t make things any worse, and we might make them better. The key is: If the worst case is k drops, the first level to try should be k.

What about after that? Well, we can go up k-1 more levels and still the worst case stays the same – you only need to check out the k-1 levels between the two points if it breaks, giving an overall of k drops.

So on the assumption that the worst case is k, the best method is to:

  1. Try floor k. If it breaks, try the k-1 floors below it, thus there can be at most k drops. Else go to 2.
  2. Try floor k+(k-1). If it breaks, try the k-2 floors below it. Combined with the two drops already done, there can be at most k drops. Else go to 3.
  3. Try floor k+(k-1)+(k-2). If it breaks, try the k-3 floors below it. Combined with the three drops already done, there can be at most k drops. Else to go 4.
  4. And so on

So what should this value of k be? Well it is the least k such that there is some r such that:

That r may as well be zero, so we just need to find the least k such that the sum of the first k integers is greater than 100. Using the formula, that is just:

As k and k+1 are next to each other, this means the answer has to be somewhere around the square root of 200, which is about 14. Indeed, 14 is the least value, as it is easily seen that 13 does not work.

Therefore the floors you should try are:

  • 14, going back to floor 1 if it breaks
  • 27, going back to floor 15 if it breaks
  • 39, going back to floor 28 if it breaks
  • 50, going back to floor 40 if it breaks
  • 60, going back to floor 51 if it breaks
  • 69, going back to floor 61 if it breaks
  • 77, going back to floor 70 if it breaks
  • 84, going back to floor 78 if it breaks
  • 90, going back to floor 85 if it breaks
  • 95, going back to floor 91 if it breaks
  • 99, going back to floor 96 if it breaks
  • 100, although by now you know it must be 100 without trying it.

I’ve written a little Java program (using Multimedia Fusion) to try out the two approaches. Check it out

Download

A Simple Evaluation of the Gaussian Integral

The Gaussian Integral is as follows:

I = \int_0^\infty e^{-x^2} \:dx

The value of I matters in statistics, for example, and it is necessarily to know its value when working with the Normal Distribution. The problem is that the usual way of evaluating it is too difficult for an A-Level student (or similar) to understand, at it changes coordinate systems in a double integral and so requires the use of the Jacobian. Even people who know about the Jacobian will probably have only seen it derived informally, and so it is best avoided.

What follows is a much simpler proof. It uses a double integral again, but only makes ordinary changes of variable. It is a common trick to evaluate a double integral in two different ways in order to prove something, but it is hard to come up with integrals where this actually works. This is one of those rare ones! The method is due to Hirokazu Iwasawa.

The integral to consider is as follows:

A = \int_0^\infty \left(\int_0^\infty xe^{-x^2(y^2+1)}\:dx\right)\:dy

Evaluting it the way suggested there, we get that:

A = \int_0^\infty \left(\frac{1}{2(1+y^2)}\right)\:dy

This can again by integrated using a usual trigometric substitution:

A = \int_0^\infty \left(\frac{1}{2(1+y^2)}\right)\:dy = \left[\frac{1}{2}\tan^{-1}(y)\right]_0^\infty = \frac{\pi}{4}

Now we swap the order of the integration, so that instead we evaluate the following:

A = \int_0^\infty \left(  \int_0^\infty xe^{-x^2(y^2+1)}\:dy  \right)\:dx

We can write this as:

A = \int_0^\infty x e^{-x^2} \left(  \int_0^\infty e^{-x^2y^2}\:dy  \right)\:dx

Using the substitution t = xy in the nested integral, we get the following:

A = \int_0^\infty x e^{-x^2} \left(  \frac{1}{x}\int_0^\infty e^{-t^2}\:dt  \right)\:dx

And we get:

A = \int_0^\infty x e^{-x^2} \left(  \frac{1}{x} I \right)\:dx = I^2

Therefore we get the result:

\int_0^\infty e^{-x^2}\: dx = \frac{\sqrt{\pi}}{2}

So every step makes sense with A-Level mathematics, proving you convince yourself that it is valid to swap the order of integration, but I think that is rather obvious. I’ve tried to put in brackets and things to show that there is nothing weird going on with double integrals, and that they really are just embedded integrals.

Possibly the biggest problem with it is that it is not obvious why you would consider that integral in the first place. But who cares? Somebody has thought of it for you.

 

%d bloggers like this: