Sunday, December 14, 2014

Our function machines (programming class 13)

who: Baan Pathomtham Grade 5 class
where: at school
when: Monday morning (bright and early!)

Ah, lucky number 13.

Homework discussion

We started by trying to figure out Titus's function machine.  This was a good continuation of our function game last time as he didn't have a chance to present a mystery function. Why don't you have a go:

Here is a link to his function machine so you can test more inputs.

While examining the output of the function S, we noticed that the results often included a repeating decimal.  For example, putting 5 into the machine gives us 12.142857142857142 (which should continue, up to the precision of the computer's calculation). This gave us a chance for a short conversation about repeating decimals and rational numbers.

I'd note that figuring out the underlying function was quite hard for the kids.

We then talked about where the other three got stuck on the homework and then spent the rest of the class helping them work through different associated issues.

The four function machines

Eventually, everyone got their function machines working, at least to the level of taking an input and giving us an output. Of course, Titus's is linked above. He is working on extensions, particularly making a loop.

Here is Gun's:

and Win's:

My function machine

As an example with some extra functionality, I showed them my function machine. At first, we entered numbers as input and it seemed pretty silly.  Then, they got a surprise when they tried something else:


The kids have two homework assignments:
  1. Extend their function machines to incorporate functionality from my program fctMchn_2.  Example extensions: add a loop so the user can try multiple inputs, animate the input and output, keep a list of the input-output pairs that have already been tried. They should feel free to make changes as this code isn't necessarily as clean or simple as it could be.
  2. Think of a project for next term. Perhaps they want to build a game, an animated presentation, something to demonstrate more mathematical concepts, a beautiful picture or they have other ideas? Encourage them to explore the following to spark some thoughts:,, other pencilcode user accounts, or have them do an online search.

1 comment:

  1. Well, Titus changed the name of his function machine and broke my link. I've made a copy of the current version, it is now at: