Header tag

Thursday, 5 December 2024

BODMAS Problems

 BODMAS problems are a recurring challenge throughout the life of a mathematician - especially at school or college.  

BODMAS stands for Brackets, Operators, Division, Multiplication, Addition and Subtraction, and sets out the order in which you must work through a maths problem to get to the correct answer.  Brackets (called Parentheses in the US) always come first, and you have to calculate what's inside them before you do anything else.  Operators are 'powers' or 'indices' and include squares, cubes, square roots and cube roots.  The rest are the normal arithmetic calculations.

For example (3*4)-2 is not the same as 3*(4-2).  And without the brackets, you'd be looking at just 3*4-2 which is ambiguous.  It's not clear which way round you're supposed to do the calculations.  What do you do first?


Mathematicians don't make these rules up to be awkward or difficult.  Mathematicians hate confusion, ambiguity and uncertainty, and therefore they use BODMAS and brackets and all these rules so that when they talk to other mathematicians anywhere in the world, they are entirely clear what they're talking about.  They are even more specific and precise than scientists (in my experience) and will take great care to make sure that they are crystal clear about their calculations.

In my experience, mathematicians who understand BODMAS problems don't get involved in the BODMAS questions that go around on social media, where there are no brackets and a whole flame war kicks off between people who defend their answer to 1+5*3.  These are badly-written problems, written that way on purpose.

Let's take a look at some simple examples of BODMAS problems, and identify some of the possible pitfalls along the way:

a) Let's start with (3*4)-2

The brackets here clearly indicate that we should calculate 3*4 first.  3*4 = 12.  12 -2 = 10.

In fact, the brackets aren't required here - Multiplication always comes before Subtraction.

Let's change the position of the brackets:

3* (4-2)

Without the brackets, we'd do 3*4 first, but with the brackets, we must calculate 4-2 first.

4-2 = 2

3* 2 = 6

So there's a clear distinction between 10 and 6.  We must be careful with our BODMAS problems.


Another one:

b)  4 * (6-22)

First is Brackets.  We must calculate the contents of the brackets, which is 6-22.
Within these brackets, we must do the Operator first.  Operators are squares, square roots, and any other powers.  In this question, the operator is the 2 squared.

22 = 4
6-4 = 2

So the contents of the Brackets comes to 2.

4*2 = 8

Let's compare this with the same calculation without the brackets, and use BODMAS to find out the value of 4 * 6-22

BODMAS says that we do the Operators first (there are no Brackets in this question), and we know that 22 = 4

This gives us:  4 * 6 - 4 

Next, we do the multiplication, so 4 *6 = 24
And finally, the subtraction, 24 -4 = 20

So now we have a difference between
 4 * (6-22) = 8
4 * 6 - 4 = 20 

Clearly we're going to have to be careful!

c) This time, let's do a calculation with algebra:

x2  + (2x * 6x) + (x -z)

Remembering to do our brackets first, we get:

x2  + 12x2 + x - z

Operators: we can't do anything further with these at this stage; all that remains now are Addition and Subtraction.  Addition comes first:

x2  + 12x2 + x - z = 13x2  + x - z

And we can't simplify this any further.

Why does BODMAS cause problems?

BODMAS expressions, like 3* (3+5+6) can occur even in simple everyday maths situations.

For example, how many wheels are there in total with on four four-wheeled cars if each car is carrying a caravan which has two wheels?

A car has four wheels; a caravan has two wheels.  That's six wheels.  And there are four cars and caravans, so that's 4 * 6 = 24 wheels altogether.

However, if you misunderstood or miscalculated, you might work like this:

There are four cars, each with four wheels.  That's sixteen wheels.  And two wheels for the caravan makes 18 wheels.

4 * (4+2) is very different from (4*4) + 2.  And that's why we have BODMAS - to help us avoid problems and misunderstandings, in cases from cars and caravans to planets and stars!

Sunday, 24 November 2024

Testing versus Implementing - why not just switch it on?

"Why can't we just make a change and see what happens? Why do we have to build an A/B test - it takes too long!  We have a roadmap, a pipeline and a backlog, and we haven't got time."

It's not always easy to articulate why testing is important - especially if your company is making small, iterative, data-backed changes to the site and your tests consistently win (or, worse still, go flat).  The IT team is testing carefully and cautiously, but the time taken to build the test and run it is slowing down everybody's pipelines.  You work with the IT team to build the test (which takes time), it runs (which takes even more time), you analyze the test (why?) and you show that their good idea was indeed a good idea.  Who knew?


Ask an AI what a global IT roadmap looks like...

However, if your IT team is building and deploying something to your website - a new way of identifying a user's delivery address; or a new way of helping users decide which sparkplugs or ink cartridges or running shoes they need - something new, innovative and very different, then I would strongly recommend that you test it with them, even if there is strong evidence for its effectiveness.  Yes, they have carried out user-testing and it's done well.  Yes, their panel loved it.  Even the Head of Global Synergies liked it, and she's a tough one to impress.  Their top designers have spent months in collaboration with the project manager, and their developers have gone through the agile process so many times that they're as flexible as ballet dancers.  They've barely reached the deadline for pre-Christmas implementation, and now is the time to implement it.  It is ready.  However, the Global Integration Leader has said that they must test before they launch, but that's okay as they have allocated just enough time for a pre-launch A/B test, then they'll go live as soon as the test is complete.


Sarah Harries, Head of Global Synergies

Everything hinges on the test launching on time, which it does.  Everybody in the IT team is very excited to see how users engage with the new sparkplug selection tool and - more importantly for everybody else - how much it adds to overall revenue.  (For more on this, remember that clicks aren't really KPIs). 

But the test results come back: you have to report that the test recipe is underperforming at a rate of 6.3% conversion drop.  Engagement looks healthy at 11.7%, but those users are dragging down overall performance.  The page exit rate is lower, but fewer users are going through checkout and completing a purchase.  Even after two full weeks, the data is looking negative.  

Can you really recommend implementing the new feature?  No; but that's not the end of the story.  It's your job to now unpick the data, and turn analysis into insights:  why didn't it win?!

The IT team, understandably, want to implement.  After all, they've spent months building this new selector and the pre-launch data was all positive.  The Head of Global Synergies is asking them why it isn't on the site yet.  Their timeline allowed three weeks for testing and you've spent three weeks testing.  Their unspoken assumption was that testing was a validation of the new design, not a step that might turn out to be a roadblock, and they had not anticipated any need for post-test changes.  It was challenging enough to fit in the test, and besides, the request was to test it.

It's time to interrogate the data.

Moreover, they have identified some positive data points:

*  Engagement is an impressive 11.7%.  Therefore, users love it.
*  The page exit rate is lower, so more people are moving forwards.  That's all that matters for this page:  get users to move forwards towards checkout.
*  The drop in conversion is coming from the pages in the checkout process.  That can't be related to the test, which is in the selector pages.  It must be a checkout problem.

They question the accuracy of the test data, which contradicts all their other data.

* The sample size is too small.
* The test was switched off before it had a chance to recover its 6.3% drop in conversion

They suggest that the whole A/B testing methodology is inaccurate.

* A/B testing is outdated and unreliable.  
* The split between the two groups wasn't 50-50.  There are 2.2% more visitors in A than B.

Maybe they'll comment that the data wasn't analyzed or segmented correctly, and they make some points about this:

* The test data includes users buying other items with their sparkplugs.  These should be filtered out.
* The test data must have included users who didn't see the test experience.
* The data shows that users who browsed on mobile phones only performed at -5.8% on conversion, so they're doing better than desktop users.

Remember:  none of this is personal.  You are, despite your best efforts, criticising a project that they've spent weeks or even months polishing and producing.  Nobody until this point has criticised their work, and in fact everybody has said how good it is.  It's not your fault, your job is to present the data and to provide insights based on it.  As a testing professional, your job is to run and analyse tests, not to be swayed into showing the data in a particular way.

They ran the test at the request of the Global Integration Leader, and burnt three weeks  waiting for the test to complete.  The deadline for implementing the new sparkplug selector is Tuesday, and they can't stop the whole IT roadmap (which is dependent on this first deployment) just because one test showed some negative data.  They would have preferred not to test it at all, but it remains your responsibility to share the test data with other stakeholders in the business, marketing and merchandizing teams, who have a vested interest in the site's financial performance.  It's not easy, but it's still part of your role to present the unbiased, impartial data that makes up your test analysis, along with the data-driven recommendations for improvements.

It's not your responsibility to make the go/no-go decision, but it is up to you to ensure that the relevant stakeholders and decision-makers have the full data set in front of them when they make the decision.  They may choose to implement the new feature anyway, taking into account that it will need to be fixed with follow-up changes and tweaks once it's gone live.  It's a healthy compromise, providing that they can pull two developers and a designer away from the next item on their roadmap to do retrospective fixes on the new selector.  
Alternatively, they may postpone the deployment and use your test data to address the conversion drops that you've shared.  How are the conversion drop and the engagement data connected?  Is the selector providing valid and accurate recommendations to users?  Does the data show that they enter their car colour and their driving style, but then go to the search function when they reach a question about their engine size?  Is the sequence of questions optimal?  Make sure that you can present these kinds of recommendations - it shows the value of testing, as your stakeholders would not be able to identify these insights from an immediate implementation.

So - why not just switch it on?  Here are four good reasons to share with your stakeholders:

* Test data will give you a comparison of whole-site behaviour - not just 'how many people engaged with the new feature?' but also 'what happens to those people who clicked?' and 'how do they compare with users who don't have the feature?'
* Testing will also tell you about  the financial impact of the new feature (good for return-on-investment calculations, which are tricky with seasonality and other factors to consider)
*  Testing has the key benefit that you can switch it off - at short notice, and at any time.  If the data shows that the test recipe is badly losing money then you identify this, and after a discussion with any key stakeholders, you can pull the plug within minutes.  And you can end the test at any time - you don't have to wait until the next IT deployment window to undeploy the new feature. 
* Testing will give you useful data quickly - within days you'll see how it's performing; within weeks you'll have a clear picture.





Monday, 18 November 2024

Designing Personas for Design Prototypes

Part of my job is validating (i.e. testing and confirming) new designs for the website I work on.  We A/B test the current page against a new page, and confirm (or otherwise) that the new version is indeed better than what we have now.  It's often a last-stop measure before the new design is implemented globally, although it's not always a go/no-go decision.

The new design has gone through various other testing and validation first - a team of qualified user experience designers (UX)  and user interface designers (UI) will have decided how they want to improve the current experience.  They will have undertaken various trials with their designs, and will have built prototypes that will have been shown to user researchers; one of the key parts of the design process, somewhere near the beginning, is the development of user personas.

A persona in this context is a character that forms a 'typical user', who designers and product teams can keep in mind while they're discussing their new design.  They can point to Jane Doe and say, "Jane would like this," or, "Jane would probably click on this, because Jane is an expert user."

I sometimes play Chess in a similar way, when I play solo Chess or when I'm trying to analyze a game I'm playing.  I make a move, and then decide what my opponent would play.  I did this a lot when I was a beginner, learning to play (about 40 years ago) - if I move this piece, then he'll move that piece, and I'll move this piece, and I'll checkmate him in two moves!  This was exactly the thought process I would go through - making the best moves for me, and then guessing my opponent's next move.


It rarely worked out that way, though, when I played a real game.  Instead, my actual opponent would see my plans, make a clever move of his own and capture my key piece before I got chance to move it within range of his King.


Underestimating (or, to quote a phrase, misunderestimating) my opponent's thoughts and plans is a problem that's inherent with playing skill and strategy games like Chess.  In my head, my opponent can only play as well as I can. 

However, when I play solo, I can make as many moves as I like, but both sides can do whatever I like, and I can win because I constructed my opponent to follow the perfect sequence of moves to let me win.  And I can even fool myself into believing that I won because I had the better ideas and the best strategy.

And this is a common pitfall among Persona Designers. 

"Jane Doe is clever enough to scroll through the product specifications to find the compelling content that will answer all her questions."

"Joe Bloggs is a novice in buying jewellery for his wife, so he'll like all these pretty pictures of diamonds."

"John Doe is a novice buyer who wants a new phone and needs to read all this wonderful content that we've spent months writing and crafting."

This is something similar to the Texas Sharpshooter Fallacy (shooting bullets at the side of a barn, then painting the target around them to make the bullet holes look like they hit it).  That's all well and good, until you realize that the real customers who will spend real money purchasing items from our websites, have a very real target that's not determined by where we shoot our bullets.  We might even know the demographics of our customers, but even that doesn't mean we know what (or how) they think.  We certainly can't imbue our personas with characters and hold on to them as firmly as we do in the face of actual customer buying data that shows a different picture.  So what do we do?



"When the facts change, I change my mind. What do you do, sir?"
Paul Samuelson, Economist,1915-2009


Sunday, 27 October 2024

My Longest Online Chess Game

 

While my search for my oldest recorded Chess game continues, I have digressed into finding my longest online Chess game.  This game was started on 25 September 2014, and again, I was Black.  Again, I faced e4 and replied ... e5.  I know this is very one-sided, but it's purely coincidental that I won this game too.  It's got a few interesting decisions throughout (I still think Chess is a game more than a logic puzzle) but a positive ending for me.  My opponent, New_Titanic, resigned, otherwise this long game could have been even longer.   

1. e4 e5
2. Nf3 Nc6
3. Bb5 a6


The way I usually play the Ruy Lopez as Black.  I'm happy to play 4. Bxf6 5. bxf6 Nxe5 6. Qd5 and then capture White's e-pawn.

4. Ba4 Nf6
5. d4 Nxe4
6. O-O b5


I'm not sure why I didn't play ... exd4, although I suspect that it would have lost to Bxf6, and hence I played ... b5 instead.  Not perfect, but playable.

7. Bb3 Bb7
8. dxe5 Be7
9. Qd5 Nxe5?


I don't think I was concentrating, because here is the first of my blunders.  Surely my move loses on the spot to Qxb7; even ...c6 is not going to be a sufficient response.  I'm not sure where my head was, because this was a poor series of moves from me.

10. Qxe5 O-O
11. Bd5 Bxd5
12. Qxd5 Nf6
13. Qd1 Ne4
14. Ne5 Bd6
15. Re1 Nxf2


I'm not sure if this was brave or stupid.  My thought was if Kxf2, then Qf6+ should win me the knight on e5.  Either way, I'm threatening the Queen which thought it was safe on d1.

16. Qd5 Qh4
17. Nf3 Bxh2+

I think I'm overcomplicating this, because Nxh2 is surely a safe move from white, leaving me material down.  Whichever it is, it seems like White is equally confused, and plays a safe move.

18. Kf1 Qg3
19. Nxh2 Nh1

Threatening checkmate, and moving my knight from the frying pan into the fire.

20. Qf3 Qxh2
21. Bf4 Qh4
22. Nd2 d6
23. g3 Nxg3+
24. Qxg3 Qh1+
25. Ke2 Qh5+
26. Qf3 Rfe8+
27. Kd1 Rxe1+

Forced, although I'd prefer not to trade (being a piece down).  My Queen is still en prise and my rook isn't looking great on e8.  My complications have got the better of me and I'm in trouble.  I'm not even well-developed.

28. Kxe1 Qh4+
29. Kd1 Re8

Two pieces down and trying to complicate as much as possible.  This is another transparent checkmate threat.

30. Bg3 Qd4
31. Kc1 Qg1+
32. Nf1 h6
33. Kb1 Re6
34. Bh4 Qd4


Re-centralising my Queen.  If White plays Qa8+ he will need to be aware of my possible move Qd1#.  I'm also threatening his Bishop on h4, so while I don't have much to do, I'm making the most of it.

35. Bf2 Qf6?
36. Qa8+ Kh7
37. Qg2? Re2!
38. Bh4 Rxg2
39. Bxf6 Rg1
40. b3? Rxf1+

Winning back all the material after two White blunders.  I'm now four pawns up, including three unopposed passed pawns on the kingside.  The long-term view (for me) is very positive; all I need to do know is shepherd them home.


41. Kb2 Rxf6
42. a4 b4
43. Re1 Re6
44. Rf1 f6
45. Rf4 c5
46. a5 g5
47. Rf1 h5
48. Rf2 h4
49. c3 bxc3+
50. Kxc3 Kg6
51. Kc4 Re5
52. Rd2 Re4+
53. Kc3 Rd4
54. Rh2 f5
55. Re2 Kf6
56. Re8 h3
57. Rf8+ Ke5
58. Re8+ Kf4
59. Kc2 h2
60. Rh8 Kg3
61. Rh5 Rh4


Blundering to the end.  Surely Rg4 was better, protecting the g-pawn.  But no, not me - I'm going to play this game my way!

62. Rxg5+ Kh3
63. Rxf5 h1=Q

Brute force.  Effective, but lengthy.

64. Kd2 Rd4+
65. Ke3 Qe4+ 

Centralised Rook and Queen against an isolated and defenceless King?  And I'm about to pick up White's Rook for good measure.

0-1

Thursday, 24 October 2024

My Very Earliest Online Chess Game

 The search continues.  I thought my previous post on my earliest online Chess game was the earliest, at 2020.  I've beaten that, with a Chess game from 2014.  Given that my blog was launched in 2010, I think I might have to search even harder.

Anyway, here's my first Chess game on Chess.com, and this one is another long-term game, with a move every three days.

I played Black, against fergosa, on 20 June 2014.

1. e4 e5
2. Bc4 Nf6

It was a recurring theme of my earliest online Chess games that my opponents would try to mate me as quickly as possible, and would therefore play ill-advised or reckless moves.  Meanwhile, I would play the sensible replies and gain an advantage from a more stable position.
  
3. d3 Nc6
4. Bg5 Be7
5. Bxf6 gxf6



No, it's not great to double my pawns, and I'm sure this would be criticised by all the experts, but I want to open the g file in case my opponent castles short.

6. Qh5 O-O
7. Qg4+ Kh8



Ok, he got a check, but my king is safe in the corner and I've vacated the g-file for my rook.

8. Qd1 f5
9. exf5 d5



Well, goodbye to my doubled pawns, and hello to an activated bishop and a pawn break in the centre.

10. Bb5 Nd4
11. Ba4 Bxf5
12. Nf3 Bg4
13. Nbd2 e4


"Always attack pinned pieces."

14. h3 Bxf3
15. Nxf3 exf3

I wonder if I could have played this better, but in the end I shattered white's kingside pawns - before he can castle short - and was a knight up.  And it's an advanced knight, in the middle of the board.

16. gxf3 c6
17. O-O Qd7

He castled kingside?  Surely the end is nigh!  I played c6 to shore up my pawn, and also to give me the d7 square for my queen.  I'm now eyeing h3.

18. c3? Qxh3

Surely 18. Kh2 was better?  Oh well...

19. b3? Rg8# 


Fiddling with queenside pawns while I finally get to place my rook on the g8 square.  And deliver checkmate!


Not perfect, but a lot of fun! 

Sunday, 20 October 2024

My Earliest Online Chess Game

 Way, way back in the dim and distant past, this blog was launched and called, "Dave's Chess Games", and was going to exclusively feature my Chess games - instructive, successful, disastrous, educational and bizarre.  I soon realised, however, that Chess blogs are two-a-penny and written by Chess players with far more skill in the game than me.  The blog was retitled Chess, Opinions, Maths and Puzzles; then it was changed to Web Analytics, Maths and Puzzles.  Looking at recent content, it could probably be called, "What is he going to write about next?" with a focus on mathematical, analytical and numerical content, and some science fiction thrown in for good measure.  Who knows?

What I do know, though, is that I've been playing Chess for a while, and playing online for about 10 years, starting on the Google Chess app, back when we had Google homepages. 

This may not be the oldest game I've played, but it's certainly a start: 7 September 2020.

The time control for this game is one move every three days, so blunders are to be criticised!

I was playing direct Chess back then, and this is what happened:  I was Black.

1.e4 e5
2.Bc4 Nf6 

All fairly standard.  I'm not going to let White play Qh5 and start making my life difficult.

3. d3 Be7


 4. Nf3 d6
5. O-O Bg4
6. h3 Bh5 


If and when White plays g4, I will almost certainly sacrifice one of my minor pieces to open up the files in front of his king.  I will then also advance my g and h pawns.  We'll see.

7. Nc3 Nc6
8. Be3 Qd7
9. Qd2 g5
10. Nxg5 Rg8
11. g4 


So, White has advanced his g pawn.  I've placed my queen on the c8-h3 diagonal, so it seems like the ideal time to sacrifice (especially since I have also place my rook on the g file).  I suspect this was as serious blunder by White - what else would I do?

11. ...   Nxg4
12. hxg4 Qxg4+
13. Kh2 Qh4+
14. Nh3 Bg4
15. Ne2 Qxh3+

There goes White's h pawn.

16. Kg1 Bf3+
17. Ng3 Qg2# 0-1


Whenever you join a new online Chess club or site, and start off as an unranked player, it seems like everybody wants to try and mate you as quickly as possible.  You're fresh meat and you're probably not very good (unlike the long-standing mediocre players you're about to face).  So a good plan against 1. e4 e5 2. Bc4 is probably a good idea.  You can play the Sicilian (1 ... c5) or like me, play Nf6.  That should slow them down a bit. 


Saturday, 19 October 2024

Film Review: Transformers One

 NO REAL SPOILERS

I was there, back in 1984, reading the comics featuring Optimus Prime and Megatron.  I started with Issue 4 of the UK run (the second half of US #2) and that was origin enough for me - the Autobots and Decepticons had arrived on Earth and had the ability to transform.  I could work the rest out backwards.

Origin stories generally have the disadvantage that you know how they turn out (we know the characters from stories we've read or seen previously).  In the case of Transformers, the history of Optimus Prime has been covered in the cartoon series, in the episode "War Dawn", where we meet Orion Pax and Elita One.

With such a depth and wealth of history, how is the latest Transformers film, simply titled, "Transformers One" going to manage to tell a new story?  Partly by rewriting canon, and partly by focusing on the characters - this is the origin story for Megatron (and by changing him from a gladiator to a miner) more than for Optimus Prime.

Orion Pax (precursor to Optimus Prime) is written with a youthful and naive optimism throughout.  D-16 (precursor to Megatron) has a similar personality, at least initially.  Bumblebee is annoying, but far better written that in any of the other Michael Bay films (I was amazed to discover that Mr Bay had got his name on this film, there's far more character development and fewer explosions than a typical Bay outing).

D-16's character arc is far more interesting than Orion's - the two characters start as friends, and in order to become enemies, one of them has to go in a different direction to the other: it's D-16 who changes course.  Orion's development to Optimus is simply due to his relentlessly pursuing 'the right thing'; D-16 is more interested in forging a different path and doing things differently.  This is partly ironic, because Orion is the one who 'breaks protocol' in order to save one of his fellow miners near the start of the film.  


There are some key plot developments around halfway through the story, and the two characters respond differently to them.  This sets D-16 on a tangential course to Orion, and the further the story develops, the further D-16 moves away from Orion.  The plot also takes over - D-16 is captured by the enemy at one point, and his experience while he's separated from Orion change him further.  As I said, this is a character story and keeping the focus on a smaller number of characters works well - because they have such distinct personalities.

This doesn't mean that the planet Cybertron is uninhabited, or populated only by faceless drones.  On the contrary, you could rewatch this film and keep finding well-known G1 characters in the backgrounds of all the well-populated scenes.  G1 fans will thoroughly enjoy tracking them all down (for the record, I spotted Jazz, Brawn, Red Alert, Sideswipe, Ratchet, Wheeljack and some of the Coneheads while watching for the first time in the cinema today).

And when you've counted all the characters, listen out for the references:  I picked up, "You don't have touch and you don't have the power!"; "Transform and Roll Out" and "You're on the surface with these idiot Gobots!".

And then there are the visual references - my favourite was close to the end, where Optimus leaps into the air to attack the 'baddies'.  The film goes into slow-mo to make sure it's not missed, but if you ever saw Transformers The Movie, you'll recognise this sequence:


This is the best Transformers film since Dark of the Moon (2011), and possibly since the Transformers (2007).  It's aimed towards children and teenagers (and benefits significantly from not having the hormone-addled Sam Witwicky and his thoroughly annoying parents), and still has plenty to offer long-time Transformers fans who are the parents of those children and teenagers.  I took my teenage son to watch it and we both thought it was amazing, for very different reasons (although the first appearance of Megatron's weapon had us both wide-eyed and amazed).