Saturday 24 August 2024

Bayes at the Bus Stop

 I make no claims to be a statistician (though I recently read a textbook* on Bayesian probability from cover to cover) and I apologise for any errors in this post: my excuse, in the words of Dr Johnson, is "Ignorance, madam, pure ignorance".

But having made that caveat, I feel that I think like a Bayesian when I am waiting for my bus home.   If there are a lot of people waiting, I reduce my estimate of my likely wait.  If there are a lot of people waiting, but then the other bus that the stop serves arrives and they all get on it, I raise my estimate.  If I see my bus leaving just before I arrive at the stop, I expect a longer wait.  And so on.

Now, I have always known that there are pitfalls in taking averages.  If I ask random people how long was their last wait for a bus and take the average, assuming they answer accurately I will possibly get a meaningful estimate of waiting times.  But if I ask random people who play golf what was the result of the last shot they played, almost all of them will have holed that shot.  That doesn't mean that almost all golf shots are holed!  Similarly if I ask cricketers what happened to the last ball they faced, most will have got out to it, but that doesn't mean that most cricket balls take a wicket.

But here is a point I have only recently fully appreciated.  What is the average class size in a school?  If a school has 60 students and two classes it might seem that the average is 30 students per class.  Suppose they are divided so that one class contains 35 students and the other 25.  The average still seems to be 30 students per class.  But if I ask every student how many are in their class, 25 will say "25" and 35 will say "35", so that average is actually higher - 30.833 by my calculation.  And arguably this is a much more meaningful figure since it better represents the experience of the students.

OK.  So now suppose that sometimes when I am waiting for my bus a friend meets me by chance at the bus stop, and that, whenever that happens, they afterwards ask me how long my total wait for the bus was on that occasion.  Let's make a few assumptions - buses come every 20 minutes, I arrive randomly at the bus stop so my average wait is uniformly distributed between 0 and 20, and I don't see buses coming or going: they materialise and dematerialise instantly giving me no clue as to how recently the last bus came.  My friend similarly arrives entirely randomly.  And of course we assume that the bus stop and my phone don't display live information about how far away the bus is, which takes all the fun out of waiting for a bus.** 

How long does my friend think my average wait is based on the data they gather?  I should be able to calculate this directly but out of laziness I simulated it in Excel.  Excel tells me (in one typical simulation of 1000 waits) that my average wait was 10.0904 minutes, while my friend's estimate was 13.3478 minutes.  Of course my friend's estimate is larger than my experience because they are more likely to meet me during a long wait than a short one.

So - here's the question.  I am waiting at the bus stop when I see my friend coming to join me.  Should I revise upwards my estimate of my likely wait, since on the occasions I meet my friend my wait is longer?  And how about if I see my friend on the other side of the street, but they don't see me?

I think I know the answer but I will leave you to think about it if you are so inclined.

* Chris Ferris, Bayesian Probability for Babies

** Not that there is any fun in waiting for a bus


Monday 27 May 2024

A puzzle from my childhood

I've reconstructed a puzzle which I remember being amused by when I came across it in a school textbook.

We expect that if you add a quantity to itself, and then take half of the result, you get the origal quantity.  That doesn't happen here.

Background: Imperial measurements. One rod (or perch) is 5.5 yards. 1 chain is 4 perches or 22 yards.  1 furlong is 10 chains or 220 yards  One mile is 8 furlongs or 1760 yards.   

Now. let's start with a distance of 1 mile, 7 furlongs, 9 chains, 3 rods and 7 yards,  Let's add this to itself.  

        

Handwritten calculation

            1    7    9    3    7

    +    1    7    9     3    7

    =    4    0    0    0    3   which when we divide by 2 gives

          2    0    0    0    1.5

So the sum is four miles and 3 yards, and if we divide this by two, we get 2 miles 0 furlongs 0 chains 0 rods and 1.5 yards - not what we started with!  Can you explain?

(The addition, in detail, from the right)

7 yards plus 7 yards is 14 yards which is 2 rods plus 3 yards,

3 rods plus 3 rods plus 2 rods (carried) is 8 rods which is 2 chains plus 0 rods,

9 chains + 9 chains plus 2 chains(carried) is 20 chains = 2 furlongs 0 chains,

7 furlongs + 7 furlongs plus 2 furlongs (carried) is 16 furlongs = 2 miles 0 furlongs

1 mile + 1 mile plus 2 miles (carried) is 4 miles.


Friday 1 March 2024

My Wordle failure

 Earlier this week, on 24 February,  my Wordle streak of over 200 successes came to a sad end. (For those who don't know the game, each day one has to deduce a five-letter word in at most six guesses, learning after each attempt whether each letter is correct and in the correct place, or correct but out of position.)  I play the hard version, which requires that each guess be consistent with the results of all previous attempts.

After two guesses I knew the word had the form _I_ER.  At this point I was in trouble - the hard version meant that every subsequent guess had to have this form, so I could try only two new letters each time and there were too many possibilities to guarantee success in the six permitted rounds.  And I failed to find the right one.

So I was interested to see this puzzle tackled by Mark Goodliffe of Cracking the Cryptic.   He faced the same problem I did.  Spoiler warning - next sentence is in white text so you don't have to read it.  Mark succeeded - with a little good fortune, which I feel he thoroughly deserved because he was aware of the possibility of repeated letters, which I had overlooked.  But (without indulging in schadenfreude) I was relieved to see from the comments that I was not the only person whose streak had ended with that puzzle - perhaps I shouldn't blame myself too much!

So how could I have done better? It seems to me that as soon as I knew that the solution contained E and R I was in difficulty.  My strategy is to choose an opening guess that is made up of common letters.  But perhaps if I want to be sure of success in six guesses I can't afford to have both E and R in my initial guess?  

Of course, success in six attempts isn't the only possible objective.  I am tyring to get my average number of attempts as far below 4 as I can, and so I may have to accept the occasional failure in order to achieve that goal - a strategy that guarantees success in six goes every time might have a higher average number of guesses.  

I know there are people who have done much more analysis than I have who know exactly how to optimise their choices but my comments are based on intuition rather than hard evidence!

Monday 1 January 2024

Laptop irritations

 This isn't really maths (except in so far as all computing is maths) but I am going to vent a couple of frustrations regarding laptops.  

First, I am sure there is a good reason for this design feature and I would be delighted if someone could enlighten me.  Here is part of the keyboard of this laptop:

Laptop keyboard

Now, note the position of the on/off switch (lit up in the photo). It's in the middle of the top row of keys. Why?  In other laptops I have used, the on/off switch is easy to find because it is placed apart from the other keys.  With this keyboard, it's hard to find (with my eyesight the marking isn't very clear to me, especially in low light, and of course it isn't lit up when I want to switch the laptop on).  Worse, it is next to the delete key, and on more than one occasion I have hit the off key instead of delete.  (You have to hold it down for a time to switch the machine off, and so far I have only accidentally switched it off once when in the middle of a piece of work, but the possibility is now always in the back of my mind.)

It seems to me utterly illogical to place the on/off switch where it is.  But it is so illogical that there must have been a deliberate design decision to do so and there must be a good reason for it.  Can anyone tell me?

My second point is just venting at an irritation.  I don't like my laptops making noises when I am working, so the first thing I do is switch off all notifications.  But still some persist.  (Why, when I save a Word document as a PDF and the file already exists, does it have to beep as well as displaying an "are you sure" box?  I find myself swearing aloud at the machine when it does this, and I have spent more time than it is worth trying to find out how to switch it off.)

What is worse than that is that the machine makes random beeps at odd times.  (These do not correlate to emails arriving or anything like that, as far as I can tell.)  It even does it when I have locked the computer.  Presumably these are important warnings, but I can't find out what they are.  Nothing has popped up in another window and there is no indication that I can see as to the reason for the beep.  What event is so important that the laptop has to interrupt me to tell me it has occurred, but isn't sufficiently important for me to be told what has happened?




Saturday 9 September 2023

Is mathematics universal? An argument from sudoku

 I have a horrible feeling that a long time ago I believed, and perhaps even tried ti persuade others, that mathematics is different from other forms of human knowledge and endeavour.  The works of Shakespeare, Beethoven and Rembrandt, for example, are contingent on human attributes, such as our language and emtions and our senses of sight and hearing.  Other species, however evolved, would be unlikely to appreciate these works as we do.  And our science is contingent on the way the universe happens to work: creatures in our universe might appreciate our ideas, but aliens in a completely different universe with different physical laws would not.

But mathematics, I once may have thought, is different.  Mathematical truths, like the facts that there are infinitely many primes or exactly 26 sporadic finite simple groups, are (it would seem) true universally and don't depend on the way humans have evolved or on the physical laws that happen to hold in our universe.  So it makes sense to send the pattern 2, 3, 5, 7, 11, 13, 17, 19, ... as a signal to outer space as a message to potential aliens (although whether it is wise to do so is a different question - our own relationships with other creatures don't suggest that engagement with more powerful species is likely to end well.)

I link to think I was always a little uneasy about this arrogant claim and that as I have grown older and perhaps wiser,  I am increasingly aware that mathematics is a cultural construct.  But what prompted this current ramble is, of all things, an absolutely beautiful sudoku presented on the Cracking the Cryptic Youtube channel - x'clusion by Florian Wortmann.  The break-in (which I didn't see for myself, though I should have) is the most wonderful I have seen.  (Spoiler alert: the rest of this parenthesis uses white text -  to appreciate it you probably need to know a couple of sudoku theorems.)

But would sudoku-solvers from an alien species appreciate it, or does it depend on the structure of the human brain? I can imagine aliens with a different brain structure, with much larger memory.  Such a species could hold all possible sudoku grids in their working memory, and solving a sudoku for them would be quickly achieved by finding the one grid compatible with the puzzle by a brute force search - not using the fascinating logic which our brains require us to apply.

I think this example suggests that mathematics is not as universal as I might once have thought, and that aliens whose brain happened to be structured differently might well have no interest in our mathematics.

(In thinking about this I have also been influenced by this video about algorithms, which shows that a hypothetical computer with a huge amount of fast-access memory could solve by brute force problems far faster than a more traditional conventional computer - the two examples given being solution of a scrambled Rubik's cube, and breaking the Double-DEC encryption system whose 112-bit key might wrongly be assumed to be immune to brute-force attack in a reasonable time.

Saturday 5 August 2023

Carnival of Mathematics 218

 I'm delighted to host for the second time the monthly Carnival of Mathematics for August 2023.  Information about the Carnival and links to previous issues can be found at The Aperiodical.

Picture of London bus No 218. Image from https://bus-routes-in-london.fandom.com/wiki/London_Buses_route_218, CC-BY-SA

This is Carnival 218, and it is customary to begin with some facts about the issue number. 

Following my immediate predecessor Vaibhav at DoubleRoot, and using the approach currently being adopted by some ill-advised students, I asked ChatGPT for some cool facts about the number 218.  Here is a sample of its responses:

1.       218 is an even number.

2.       It has three digits: 218 is a three-digit number, with the hundreds digit being 2, the tens digit being 1, and the units digit being 8.

3.       It is a Harshad number: 218 is a Harshad number, which means it is divisible by the sum of its digits (2 + 1 + 8 = 11, and 218 ÷ 11 = 19).

4.       The number 218 can be expressed as a sum of positive integers in multiple ways. One possible partition is 218 = 109 + 109.

5.       A year on the planet Mars is approximately 687 Earth days. Interestingly, 218 days on Mars is approximately equal to 1/3 of a Martian year.

6.       The number 218 is a numeric palindrome, meaning it reads the same forwards and backward.

7.       218 is sometimes used in scientific research as a numerical identifier for various purposes, such as labeling experimental groups or samples.

What do you say?  These seem to be either trivial (1, 2, 4, 7), plain wrong (3, 6), or stretching the meaning of “Interestingly” and “approximately” (5).   Well, what did you expect from ChatGPT?  If you want something that is interesting and true, much better to consult Wikipedia on “218 (number)”, which tells me

“218 is the number of inequivalent ways to color the 12 edges of a cube using at most 2 colors, where two colorings are equivalent if they differ only by a rotation of the cube.”

But on to the content you’ve come for.  What’s new in the maths online world? (Due to a technical problems some suggestions for the July Carnival were temporarily lost in the ether so “new” includes some links that might have appeared last month.)

Well, July saw the premieres of two blockbuster movies, one of which is of obvious mathematical interest.  So here from Cambridge Mathematics is A brief history of Barbie and mathematics. (Apart from the infamous “Math class is hard” which a version of Barbie in 1992 would “say”, it also mentions the dreadful Barbie book “I Can Be a Computer Engineer” of 2013 (which was subsequently retracted), but also contains interesting historical analysis of Barbie matters over the last 64 years).  And if you are more interested in the other film, Michael Molinsky in his “Quotations in Context” column on the Mathematical Association of America website has explored a talk by J. Robert Oppenheimer – “Today, it is not only that our kings do not know mathematics, but our philosophers do not know mathematics and – to go a step further – our mathematicians do not know mathematics.”

For another mathematician of the middle of the last century, the Infinitely Irrational podcast explored The Gödelfather: A Mathematical Masterpiece with special guest Ioanna Georgiou.  And, on the topic of logic, my own short talk about an earlier philosopher, the legendary John Buridan, and his mathematical paradoxes, was published by G4G Celebration.

The hot mathematical topic recently has been tiling – since the Carnival is organised by The Aperiodical, it is entirely appropriate that we continue to cover the continuing excitement about aperiodic tilings which followed the discovery of the “Ein Stein” single tile which aperiodically tiles the plane.  Ayliean MacDonald went (for some reason) to the village of Newtyle in Scotland (which turns out to be not far from my father’s hometown of Forfar) to record an update to her previous video which featured in last month’s Carnival.  Her new one is a Numberphile video about the New Tile (and the topic is moving so fast that Future Ayliean had to interrupt the video with news of developments since it was recorded).   The discovery by Craig S. Kaplan, David Smith, Joseph Samuel Myers, and Chaim Goodman-Strauss of the Ein Stein, and subsequently the Spectre Tile which tiles aperiodically without reflections, also featured in a new G4G Celebration video.  Meanwhile  Fractal Kitty provides translucent pngs of the Spectre tile.

Here now is my random selection of further miscellaneous maths things which have recently appeared (with many thanks to those who emailed me their suggestions).

The New York Times marked the 50th anniversary of The Encyclopedia of Integer Sequences. (Behind a paywall but with limited free access.)

Given the “facts” put forward by ChatGPT when I asked about the number 218, here is a timely article on Understanding AI: how large models work by Timothy B Lee and Sean Trott.  Meanwhile Neil Saunders argues at Medium.Com that while generative AI is “staggeringly competent” (the examples above don’t entirely convince me of that) it nevertheless doesn’t have any understanding.

Here is an account by Robert Smith about creating an algorithm for a computer to solve Rubik’s cube.  And here is an older (but I only recently found it) insightful video account of an algorithmic subtlety on the polylog Youtube channel, which starts with Rubik’s cube but gets into cryptographic security.

You’ll enjoy Alan Becker’s charming Animation vs. Math - and Dr Tom Crawford (@TomRocksMaths) has made a reaction video.

As always, the Cracking the Cryptic youtube channel presented examples of its expert sudoku solvers thinking mathematically in solving variant sudokus.  In solving this wonderful puzzle by Florian Wortmann, Simon Anthony finds an astonishingly beautiful break-in (which I have to admit eluded me when I tried the puzzle, although, being familiar with the two sudoku theorems required, I felt that I should have seen it for myself).

Colin Wright happened across a proof of Pythagoras’s Theorem using the Incircle.

James Propp presents a wide-ranging discussion about mistakes in calculations.

Karen Campe, whose blog will host the September Carnival of Mathematics, has provided A Shoutout for Squares.

Kyle Evans was interviewed by the Aperiodical about his forthcoming Edinburgh Fringe maths show, Maths at the Museum.

Matt Parker took advantage of the recent publication by David Cushing and David I. Stewart to buy just enough UK national lottery tickets to guarantee a win (but "a win" doesn't mean "a profit"!) (For a link to the paper see underneath Matt’s video.)

Sam Hartburn presents a song about a Knight’s Tour.

Snezana Lawrence is the guest of Mathematical Association President Professor Nira Chamberlain OBE in his VLOG.

Here's a Twitter (as it once was) thread on diversity in understanding mathematics, started by Talia Ringer.

Want to play the mathematical pattern-spotting game Set but would prefer a Non-Abelian or Projective version?  Check out Catherine Hsu’s Numberphile video.

Here is a Padlet roundup of maths questions on TV quiz shows (by missradders).

For those seeking an alternative to whatever the former Twitter is now called, here from the Continuous Everywhere but Differentiable Nowhere blog is an invitation to join mathstodon.xyz

And that's the end of this month's Carnival of Mathematics.  Enjoy!  And when the time comes, check out the September Carnival via The Aperiodical.

Image of London bus from https://bus-routes-in-london.fandom.com/wiki/London_Buses_route_218CC-BY-SA 






Monday 24 October 2022

The 24 Hour Maths Game Show

Following the 24 Hour Maths Magic Show two years ago, this coming weekend brings the 24 Hour Maths Game Show!  Starting at 7pm on Friday 28 October there will be 24 hours of mathematicians presenting mathematical games, or games about mathematics.  For details of the stellar line-up and the exciting fun in prospect see the event website.  The event is raising money for four excellent charities - Beat Eating Disorders, the Rheumatoid Arthritis Foundation, the Disasters Emergency Committee, and the Malala Fund: donations to one or more on the event Just Giving page

I have the coveted Saturday morning 8:30-9am slot UK time (which is prime time for viewers in some part of the world) and I’ll be talking about the Hypergame paradox and how I trapped two students into starting a game which may go on for ever.  (There is a happy ending.)