It's all in the code

The NRICH Number Plumber

with 16 comments

The Number Plumber is one of those teaching applications I thought I wouldn’t have to write. It’s such an obvious idea that someone must have done it before. Well of course they have, but – at least in my view – badly. I await your comments pointing me to all the applications ‘out there’ that we (and I’m including Alf Coles who must take the credit for first pointing this out) should know about:). NRICH is a great believer is so-called ‘rich’ mathematical problems – problems that have some depth to them, that can be tackled in a number of ways, that lead to conjectures, that may hint at theorems. Well it’s about time that we applied the same philosophy to our interactive resources and started to design those with depth. We’ve done this in the past on occasions – Shuffles and the Geoboard spring to mind – but all too often we invest valuable time in one-offs that serve one purpose and one problem.

There is a challenge involved in adding depth to a teaching animation. The more that an animation can do, the harder it can be for teachers and learners to feel comfortable with those features, and the harder it is to write. The aim must always be to discover natural user interface metaphors that feel right. While the well-understood user interface widgets such as menus, buttons, steppers and combo-boxes do have their place in this regard, they can also make a learning application feel like a tedious form-filling exercise. We do need imagination to inspire.

The Number Plumber has a new widget at its core which I call a ‘Flow’ in the source code. In the animation itself, flows appear in the guise of ‘Inputs’, ‘Operations’, and ‘Outputs’. The flow metaphor I have in mind is of a wash basin complete with drain pipe and outlet. Numbers are like water in this metaphor. You can drop them into a flow and they will travel down the drain,  possibly dropping into other flows where they may mingle in interesting ways with other numbers, finally emerging in a transformed state at the output pipe.

You can drag inputs, operations, and outputs from their panels (top right) onto the main stage of the application. Each flow has a plumbing joint at its base represented by a white blob. Dragging this out gives you a pipe and an outlet. Drop the outlet onto an input pad in another flow and you have made your first connection. The world needs more plumbers.

In this first post I’m not going to give you a complete manual. I’m really rather hoping that you don’t need one. I’m hoping you will pick up a Number Plumber and play with it. It should not be too hard to discover how to make interesting examples. However I do want to give you a two step roadmap – something that will help you find your way round.

Create an Example

Step 1: Create an Example

In Step 1 we open the Example Builder and start to create an example. When we’ve set things up exactly how we want it, we can save the example for later use. You can create a hyperlink to any saved example so long as you publish the saved file at a web address. The step 2 example shown below was saved in ‘step2.xml’ and then uploaded to a web server. You can access the live step 2 example here and you can see the saved example file here – it’s just text.

An example of a defined function. Good for 'Guess the Map' examples

I hope that’s enough to get you started. One more thing, if you create some neat examples, do publish your XML files somewhere and let us know about them. We’d like to start building a list. You can tell us where your examples are here in the comments or email them to

Written by gmp26

February 23, 2010 at 11:14 am

Posted in Number Plumber

16 Responses

Subscribe to comments with RSS.

  1. I hope teachers will rise to the challenge, and play with the Number Plumber. Having seen it in various stages of its development, I’ve got very used to how it works so it will be interesting to get feedback about which parts are the most intuitive to use from people coming to it cold, as well as seeing new ways to use it that we haven’t thought of yet!


    February 23, 2010 at 1:49 pm

    • Yes, and we need to can a few examples ourselves too.


      February 23, 2010 at 3:11 pm

  2. I’ve had a play with the Number Plumber with a view to using it in my teaching next term. So far I have been able to produce something that I can use for teaching substitution into expressions for year seven and teaching direct proportion to year ten.

    I have encountered a few problems and aspects I don’t understand and was wondering if you could help me out:

    1) There is the unary operation of ln but there is no binary operation of log [] with a chosen base. Is there a reason for this?

    2) Whilst most of the environment is self-explanatory I am struggling to figure out how to use Sequence Generation. Is it possible to use the Number Plumber to create APs and GPs?

    3) When trying to plan a lesson on inverse proportion I tried to use the binary operation over. By itself it works fine but when part of a larger example I keep encountering the error message, “too many inputs”.

    This is an excellent resource and I think the more I play with it the more ideas I will have to embed this into my teaching.

    Paul Alexander

    April 7, 2010 at 11:32 am

    • Thanks for the feedback Paul – very useful. On your specific points:

      1) No reason really except that you can use the Define button to create such a function using log_b(x) = ln(x)/ln(b). Still, if you want the convenience of a prebuilt log to any base let me know and I’ll build one. I’d guess the priorities would be ln, then log_{10}, and only then log_b.

      Here’s an example of defining and then using a log to any base function.

      2) I’ll look at APs and GPs and let you know. The Sequence Generation functionality needs quite a bit more work yet to make it really useful – it was a fairly late addition to support one of the March problems and currently only supports recurrences. Ah – that means APs and GPs should work using f_n = f_{n-1) + d, and f_n = r \times f_{n-1} respectively. f_{n-1} is available from the Feedback box when f_n is in the output box. The Drop and Catch box gets you access to f_{n-2}, and they can be chained to yield f_{n-3}, f_{n-4},…

      Here’s a GP example starting at 1, common ratio 3.

      3) I haven’t seen this problem. Can you send me a saved example which shows it? The ‘too many inputs’ error message should appear if more than 2 inputs feed into one output. The limitation is there because the animation only understands unary and binary functions.



      April 7, 2010 at 12:03 pm

      • 1) I was thinking about doing something with my year twelves on the rules of logs. With the way the syllabus is organised ln is not covered until year 13 and converting between bases is never covered. I would like to go above and beyond but time does not allow me to. I could, I suppose define the function for them then give them the saved function.

        2) I have had another play with the drop and catch box but it is not intuitive. Well not intuitive for someone with my lack of intuition.

        3) In true ICT problem style, I had another go at recreating my inputs problem and in doing so I have solved the problem. I have though sent to the enquiries at nrich address a very rough version of what I was trying to do.

        Paul Alexander

        April 7, 2010 at 1:11 pm

  3. Paul, I’ll add a log_b in the next release along with a few other binary ops that could be useful for things like LCM/GCD such as integer division and remainder and email you when it’s done.

    I agree about Drop and Catch – it’s not something most people will have met, though audio engineers may recognise it as a unit delay. The name describes what it does – it drops the value it contains and then catches the new one. Every other box catches a new value before dropping a calculated value. You might find it easier to think of it as a memory register – saving the number dropped in for use next time. Neither the feedback nor the drop and catch boxes should be used if you want to investigate functions.


    April 7, 2010 at 1:46 pm

      • Brilliant. Thank you. I will use that to help teach rules of logs next term. I just had a play and it worked really well. The only thing was it crashed when I tried to change inputs which has happened before. I know I should have saved but I thought you should be aware of this bug.

        I like the ideas for other binary functions. One small point, any chance you could call GCD, HCF for us English? It never fails to confuse my students.

        Paul Alexander

        April 7, 2010 at 2:29 pm

      • Paul, if you get a crash from the animation I’d love to see the contents of the Flash crash report box. It may be that your browser crashed though – in which case check you have the most recent version of Flash Player, and pester your school technicians till they install it. Browser choice may be important too. We find Firefox, Safari and Chrome to be better than IE. I know schools are hooked on IE😦

        I’m English too, but I tend to call it gcd since I live in the programming world. Functions can be renamed using Define.


        April 7, 2010 at 2:39 pm

    • I use Firefox as our ICT department are open about us installing what we like on our laptops. I am trying to get it to crash now but it is difficult to get something to go wrong when you want it to. What happened before is the egg timer came up, the page froze then eventually after coming back up a bit later the page had stopped working like being able to drag objects. Other tabs worked fine. Not sure if this helps.

      Paul Alexander

      April 7, 2010 at 3:19 pm

  4. Just had a go with the Feedback command for creating a GP. Fantastic. Appologies if I am being greedy here but is there anyway to keep then sum the values to create a series?

    Paul Alexander

    April 7, 2010 at 2:35 pm

    • I don’t think so at the moment. I think we need at least one more operation in Sequence Generation to make it complete. Just not sure which one yet. We might get a long way by making feedback plumbing explicit, so you could create loopbacks from any value. That might open Pandora’s box though.


      April 7, 2010 at 3:02 pm

      • Having thought about this for a day or two, I think if there was a button on the function thingy, next to say drop and define that generated the function’s inverse there are a lot of possibilities on where you could go. I can imagine that the coding would be very difficult, only imagine though as I have no real idea.

        Paul Alexander

        April 10, 2010 at 9:29 am

  5. I’m not sure how an inverse button would work really. Would it not be a better exercise for students to construct the plumbing needed to generate an inverse? The ‘Completing the Square’ example is a case in point.


    April 12, 2010 at 2:01 pm

  6. Thanks for this resource! My KS2 children have had great fun looking at the last digit(s) loop patterns generated by ‘Becky’s number plumber’ on the nrich site. They then created their own number plumbers using the same pattern (multiply then subtract) but with different numbers. Two groups ran into an interesting bug: if you set up the plumber with x9, -7, and start with an input of 2, the unit digit cycles between 1 and 2 … until the 17th iteration, when the plumber produces 2084647712458322 x 9 = 18761829412124896, and 18761829412124896 – 7 = 18761829412124890 !
    They eventually spotted that this must be a mistake (“2 x 9 must end in an 8”), decided to calculate this themselves and were shocked that “the computer was wrong”. They were even more amazed when they clicked the ‘show working’ button, and realised that the plumber was not looping the answer back to the input, but was calculating the (((2*9 – 7) *9 – 7) *9 -7)… from scratch. Cue lots of arguments about whether the computer could ‘get lost trying to remember where it was’.

    Damian Hassan

    April 20, 2010 at 11:28 am

    • Tell your class they did well to spot that!

      I think your class are hitting the size limitations of computer floating point arithmetic operations. The floating point format has to fit the number and its exponent in 64 bits. When it can’t do that it will start rounding, so even integer arithmetic starts to lose precision.

      I hope it provokes an interesting discussion about how computers represent numbers!


      April 20, 2010 at 12:36 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 110 other followers

%d bloggers like this: