Computer Science, Logic, Math and Computer Science Everywhere, Notes on everyday life, Simon's sketch book

The three ages or 1-input 1-output logic gates

After a whole night working on my writing and not feeling very fresh in the morning, I told Simon about the three ages of life: the young age is when one can party all night long and the next morning feel like one has been sleeping like a rose, the middle age is when one parties all night long and the next morning feels like one had been partying all night long, and the old age is when has been sleeping all night long and the next morning feels like one has been partying all night long. He immediately drew these pictures, telling me it’s just like 1-input 1-output logic gates, but the only one that makes sense is the OR.

Crafty, Geometry Joys, Math and Computer Science Everywhere, Math Riddles, Murderous Maths, Simon makes gamez, Simon teaching, Simon's sketch book, Together with sis

Fun crafty puzzles Simon did with Neva

Three boxes with fruit, all the three labels are misplaced. What is the minimum number of times one will have to sample a random piece of fruit from one of the boxes to know how to label all the three boxes correctly? From Mind Your Decisions.

Connect A and A’, B and B’, C and C’, D and D’ so that no lines intersect. (Neva added colors).

Dividing 11 coins among three people: “How many ways can you divide 11 coins to 3 people? How many ways are there if each person has to get at least 1 coin?” From Mind Your Decisions.

Solving a simple quadratic equation geometrically: the geometric interpretation of “completing the square”, a notion from deriving the quadratic formula. From Mind Your Decisions.

Which way do the arrows point? (Simon made this drawing in Microsoft Paint):

Coding, Coding Everywhere, Experiments, JavaScript, Milestones, Murderous Maths, Simon teaching, Simon's Own Code, Simon's sketch book

How Many Dice Rolls Until You Get a Repeat. A Probability Experiment in p5.js

How many times, on average, do you have to roll a dice until you get a repeated value? I saw this probability challenge on the Mind Your Decisions channel. I decided to test it experimentally. First, I repeated the experiment myself in two sets of 50. Then I created a diagram in the Wolfram Language to visualize the distribution. Finally, I made a p5.js sketch to roll the dice thousands of times.

repeated the experiment in two sets of 50

Link to my code: https://editor.p5js.org/simontiger/sketches/gM0xws9D

Link to my Wolfram Notebook: https://www.wolframcloud.com/obj/620bf4df-077f-4ce8-8210-c06037f58f9b

explaining the math to dad at dinner

The math behind this project come from this Mind Your Decisions challenge video and this Mind Your Decisions solution video.

Logic, Math and Computer Science Everywhere, Murderous Maths, Notes on everyday life, Philosophy, Simon teaching, Simon's sketch book, Thoughts about the world

Simon’s graph theory thoughts about the overpopulation problem

In a complete binary tree, every node has two children (except for the bottom nodes that don’t have any children at all). This means one mind-blowing thing: that the bottom row always has more nodes than the number of nodes in the entire rest of the tree! Example: if there’s one node at the top of the tree, two nodes in the second row, four nodes in the third row and eight nodes in the bottom row, the bottom row has more nodes (8) than the remaining part of tree (7). I’ve been thinking about this, and I applied this to the real world:

The average number of children a parent has in the world is 2.23 (I’ve used an arithmetic mean, which is oversimplistic, should have probably used the harmonic mean). Does this mean that currently, the number of children exceeds the number of parents? The definition of “children” I’m using are people who don’t have children, so the last row of nodes so to speak. By “parents” I’m counting all generations. If you just want to talk about now, the parents living now, then you have to trim the top rows (the already dead generations). If the average number of children is 2 or more, are there going to be more children in the world than parents?

Well, in this model, I’m ignoring crossover. This means we should consider every node in our tree for 2 people*. So, now, if the average number of children is 4 or more, there’re going to be more children than parents. So, what I said earlier was wrong. The average number of people doesn’t exceed 4, so there aren’t more children than parents. But the number of children today may still exceed the number of parent generations still alive.

Coding, Geometry Joys, JavaScript, Milestones, Murderous Maths, Simon teaching, Simon's Own Code, Simon's sketch book

Space-filling Curves in p5.js.

Simon prepared this project as a community contribution for The Coding Train (Simon came up with his own way to draw the Hilbert Curve and added interactive elements to enable the user to create other colourful space-filling curves (Hilbert Curve, Z-order Curve, Peano Curve and more!). You can see Daniel Shiffman’s Hilbert Curve tutorial and coding challenge on The Coding Train’s website (including a link to Simon’s contribution) via this link: https://thecodingtrain.com/CodingInTheCabana/003-hilbert-curve.html

Interactive full-screen version, allowing you to change the seed and the grid size: https://editor.p5js.org/simontiger/full/2CrT12N4

Code: https://editor.p5js.org/simontiger/sketches/2CrT12N4

Screen shot of The Coding Train website with a link to Simon’s contribution
Biology, Coding, Experiments, JavaScript, Milestones, Simon teaching, Simon's Own Code, Simon's sketch book

Evolving Creatures in p5.js

Simon’s latest independent coding project involved some biology lessons! He loves the channel Primer by Justin Helps and watched his evolution series many times, studying the rules for species’ survival and multiplication. This resulted in two interactive evolution simulations, in both of which Simon recreated the rules he learned. The first simulation doesn’t involve natural selection and is based on these two videos: Simulating Competition and Logistic Growth and Mutations and the First Replicators.

Full Screen interactive version: https://editor.p5js.org/simontiger/present/MK4b75542

Code: https://editor.p5js.org/simontiger/sketches/MK4b75542

Simon added natural selection in Part 2, based on Primer’s video Simulating Natural Selection (the code Simon wrote from scratch):

Full Screen interactive version: https://editor.p5js.org/simontiger/present/68WXliTza

Code: https://editor.p5js.org/simontiger/sketches/68WXliTza

Crafty, Geometry Joys, Math Riddles, Math Tricks, motor skills, Murderous Maths, Simon teaching, Simon's sketch book

Alternating series, a crafty solution.

What does this infinite sun converge to?
Cut the four L-shapes out…
Divide the central L-shape in four L-shapes and cut those out, too…
You can go on forever…
but it’s already clear at this step, that the sum converges to 2/3 (two of the three squares the original L-shape was made up of)

Simon learned this from an alternating series visualization by Think Twice.