If you want to sell a toy for the toddler crowd, it ought to be pretty close to indestructible. A lot of toys out there are just plain nonsense game-wise and therefore waste their beefy potential. [2dom]’s wife was close to throwing out such a toy—a Little Tikes Goofy Ball. The thing literally does nothing but let you push its big buttons in. After some time passes, it pops them back out again and giggles. Game over. [2dom] rescued it from the trash and turned it into a toy that plays math games.

[2dom] removed the existing board and replaced it with an Arduino Pro Mini and a Darlington array that drives the motor that pops the buttons back out, the speaker, and a Nokia 5110 screen. Upon startup, the user chooses between addition, subtraction, and multiplication questions using the appropriate button. Questions appear in the middle of the screen and multiple choice answers in the corners.

Choose the right answer and the ball cheers and shows one of a few faces. Choose the wrong answer and it makes a buzzing sound and shows an X. There is an adaptive level system for the questions that [2dom] doesn’t show in the demonstration video after the break. For every five correct answers, you level up. His 3- and 5-year-olds love it. For more advanced teachable moments, there’s this toy-turned-enigma-machine.

We all know and love OpenSCAD for its sweet sweet parametrical goodness. However, it’s possible to get some of that same goodness out of Fusion 360. To do this we will be making a mathematical model of our object and then we’ll change variables to get different geometry. It’s simpler than it sounds.

Even if you don’t use Fusion 360 it’s good to have an idea of how different design tools work. This is web-based 3D Modeling software produced by Autodesk. One of the nice features is that it lets me share my models with others. I’ll do that in just a minute as I walk you through modeling a simple object. Another way to describe what we’re going to learn is: How to think when modeling in Fusion 360.

If I asked you to find the area of a square, you would have no problem doing so. It would be the same if I asked you to find the volume of a cone or rectangle or any other regular shape. You might have to turn to Google to get the proper formula, but it would be a trivial process nonetheless. But what if I asked you to find the volume of some random vase sitting on a kitchen counter? How does one go about finding the volume of irregular shapes?

One way would be to fill the vase with much smaller objects of a known volume. Then you could add up the smaller volumes to get an estimate of the total volume of the vase. For instance, imagine we fill the vase with marbles. A marble is a sphere, and we can calculate the volume of each marble with the formula 4/3πr^{3}. We count all of our marbles and multiply the total by the volume of a single marble and arrive at our answer. It is not perfect, however. There is a lot of empty space that exists between the marbles as they fill the vase. We are forced to conclude that our estimated volume will be lower that the actual volume.

It would be about this time when our good friend Isaac Newton would ask the question “What if you made the marbles smaller?” Reducing the size of each marble would reduce the empty space that exists between them as they pile up in the vase, giving us a more accurate total volume. But how small? Is there a limit to how small we can make them? “Do not trouble yourself with the limit.” says [Newton]. “You will find that as you make the marbles smaller and smaller, you will begin to converge on a single number – and that number will be the exact volume of your vase.”

Reducing the size of the marble to get a more exact volume demonstrates the idea of the integral – one of the two fundamental principles of The Calculus. The other principle is known as the derivative, which we explained in our previous article by taking a very careful and tedious examination of an arrow in flight. In this article, we shall take the same approach toward the integral. By the end, you will have a fundamental understanding of what the integral is, and more importantly, how it works. Our vase example gives you a good mental image of what the integral is all about, but it is hardly a fundamental understanding of it. Just how do you make those marbles smaller? To answer this question, let us look again at one of Zeno’s moving arrows.

Control systems are all around us, and understanding them is going to make you much better at hardware design. In the last article — Beyond Control: The Basics of Control Systems — we looked at an overview of what a control systems are in general with the example: “everything in between water and time is a control system”. We also observed control systems in nature, where I described my keen ability to fill a glass of water without catastrophic results. That discussion involved the basic concept of a block diagram (without maths) and we expanded that a bit to see what our satellite dish example would look like (still without maths).

I promised some big ugly maths in this article, and we’ll get to that in a bit, never you fear. First let’s have a look at how some basic elements: resistors, inductors, and capacitors are defined in the time domain. Don’t let these first few definitions turn you off. No matter how you feel about calculus, you don’t necessarily need to fully understand each equation. What’s more important is how the equations themselves combine to solve the circuit. Also important is that I will do everything possible to get out of doing difficult math. So stick with me through the article and you’ll learn that agony-saving trick for yourself!

A quick recap on transfer functions before we get going might be beneficial. A control system is used to define electromechanical behavior. For example: our satellite dish (from the previous article) at some point will need to be moved from one position to another position and as control engineers it is our job to determine just how this action will take place. I’m not talking about setting the mood for the big emotional robotic rotation, more like: not damaging the equipment or any people that might be nearby when moving the dish. For many reasons the dish would need to be moved with extreme care and in a very precise manner. The control system is the mathematical definition of that movement. Often the maths of the definition are nasty differential equations, (remember I’m avoiding any math that can be avoided, right?) so, instead of using differential equations to define the system, the transfer function will define the system with algebra, relating the output of the system to the input.

The Calculus is made up of a few basic principles that anyone can understand. If looked at in the right way, it’s easy to apply these principles to the world around you and to see how the real world works in their terms. Of the two main ideas of The Calculus — the derivative and the integral — today we’ll focus on the derivative.

You can enjoy this article by itself, but it is also worth looking back at the previous installment in this series. We went over the history of The Calculus and saw how it arose from two paradoxes put forth by a 4th century philosopher named Zeno of Elea. These paradoxes lead to the derivative/integral ideas that revolutionized mankind’s understanding of motion.

“Everything should be made as simple as possible, but not simpler.”

Albert Einstein

Our journey begins with a fictitious character whom we shall call [John Doe]. He represents the average professional worker who can be found in cities and towns across the world. Most everyday, [John] wakes up to his alarm clock and drives his car to work. He takes an elevator to his office and logs on to his computer. And he does these things without the slightest clue of how any of them work. While he may be interested in learning about the inner workings of the machines and devices he uses on a daily basis, [John] does not have the time and energy to invest in doing so. To him cars, elevators, computers and alarm clocks are completely different and complicated machines with hardly any similarities. It is simply not possible to understand how each of them work without years of study.

The regular readers of Hackaday might see things a bit differently than our [John Doe]. They would know that the electric motor that moves the elevator is very similar to the alternator in his car. They would know that the PLC that controls the electric motor that moves the elevator is very similar to the computer he logs in to. They would know that on a fundamental level, the PLC, alarm clock and computer are all based on relatively simple transistor theory. What is a vast complicated mess to [John Doe] and the average person is nothing but the use of simple mechanical and electrical principles to the hacker. The complication resides in how those principles are applied. Abstracting the fundamental principles from complicated ideas allows us to simplify and understand them in a way that pays homage to Einstein’s off-the-cuff advice, quoted above.

Many of you look at The Calculus the same way [John Doe] looks at machines. You see the same vast, complicated mess that would require a great deal of time and effort to understand. But what if I told you that calculus shares a commonality in much the same way many different machines do. That there are a few basic principles that anyone can understand, and once you do, it will unlock a new way of looking at the world and how it works.

The average calculus course book is a thousand pages long. The [John Does] of the world will see a thousand difficult things to learn. The hacker, however, will see two basic principles and 998 examples of those principles. In this series of articles, I’m going to show you what these two principles – the derivative and the integral – are. Based on work done by Professor [Michael Starbird] of The University of Texas at Austin for The Teaching Company, we’ll use everyday examples that anyone can understand. The Calculus reveals a particular beauty of our world — a beauty that arises when you’re able to view it dynamically as opposed to statically. It is my hope to give you this view.

Before we get started, it pays to understand a little of the history of how The Calculus came about, and how its roots lie in the very careful analysis of change and motion.

Zeno’s Paradox

Zeno of Elea was a philosopher in the fourth century BC. He posed several subtle but profound paradoxes, two of which would eventually give rise to The Calculus. It would take over 2,000 years for man’s ingenuity to solve the paradoxes. As you can imagine, it wasn’t easy. The difficulties largely revolved around the idea of infinity. How do you deal with infinity from a mathematical perspective? Sir Isaac Newton and Gottfried Leibniz would go on to independently invent The Calculus in the mid 17th century, finally putting the paradoxes to rest. Let us take a close look at them and see what the fuss was all about.

The Arrow

Consider the arrow flying through the air. We can say with reasonable and competent assurance that the arrow is in motion. Now consider the arrow at any given instant in time. The arrow is no longer in motion. It is at rest. But we know the arrow is in motion, how can it be at rest! This is the paradox. It might seem silly, but it’s a very challenging concept to deal with it from a mathematical point of view.

We’ll find out later that what we’re really dealing with is the concept of an instantaneous rate of change, which we will elaborate on with the idea of one of the two principles of calculus – the derivative. It will allow us to calculate the velocity of the arrow at an instant in time – a monumental feat that took over two millennia for mankind to reach.

The Dichotomy

Let us consider the same arrow again. This time let’s say the arrow is coming at us. Zeno says we don’t have to move, because it can never hit us. Imagine that as the arrow is in flight, it has to cover half the distance between the bow and the target. Once it reaches the half way point, it has to do this again – move half the distance between it and the target. Imagine that we keep doing this. The arrow is constantly moving halfway between its origin and target. By doing this, the arrow can never hit us! In real life, the arrow does eventually hit the target, leaving us with the paradox.

As with the first paradox, we’ll see how to resolve this issue with one of the two principles of calculus – the integral. The integral allows us to deal with the concept of infinity as a mathematical function. It is an extremely powerful tool to scientists and engineers.

The Two Principles of Calculus

The two main ideas of The Calculus will be demonstrated by using them to solve Zeno’s paradoxes.

The Derivative – The derivative is a technique that will allow us to calculate the velocity of the arrow in “The Arrow” paradox. We will do this by looking at positions of the arrow through incrementally smaller amounts of time, such that the precise velocity will be known when the time between measurements is infinitely small.

The Integral – The integral is a technique that will allow us to calculate the position of the arrow in the Dichotomy paradox. We will do this by looking at velocities of the arrow through incrementally smaller amounts of time, such that the precise position will be known when the time between measurements is infinitely small.

It’s not difficult to notice some similarity between the derivative and integral. Both values are calculated by examining the arrow with increasingly finer time intervals. We will learn later that the integral and derivative are in fact two sides of the same ceramic capacitor.

Why Should I Learn Calculus?

We are all familiar with Ohm’s Law, which relates current, voltage and resistance in a simple equation. However, let us consider “Ohm’s Law” for a capacitor. A current flow through a capacitor is dependent on the voltage across it and time. Time is the critical variable here, and must be taken into account in any dynamic event. Calculus lets us understand and measure how things change over time. In the case of a capacitor, the current through it is equal to the capacitance multiplied by volts per second, or: i = C(dv/dt) where:

i = current (instantaneous)

C = Capacitance in Farads

dv = change in voltage

dt = change in time

In this circuit, there is no current flow through the capacitor. The volt meter will read the battery voltage and the ammeter will read zero amps. So long as the potentiometer is not moved, the voltage on the meter will be steady. Our equation would say that i = C(0/dt) = 0 amps. But what happens when we adjust the potentiometer? Our equation says there will be a resulting current flow in the capacitor. This current flow will be dependent on the rate the voltage changes, which is tied to how fast we move the potentiometer.

These graphs show the casual relationships between the voltage across the capacitor, the current through the capacitor and the speed we turn the potentiometer. It starts with the potentiometer turning slowly. An increase in speed results in a faster changing voltage which in turn results in a dramatic increase in current. At all points, the current through the capacitor is proportional to the rate of change of the voltage across it.

Calculus, or more specifically the derivative, gives us the ability to quantify this rate of change, so that we can know the exact value of current running through the capacitor at any given instant in time. The same way we can know the instantaneous velocity of Zeno’s arrow. It is an incredibly powerful tool to have in your hacking arsenal.

In the next article, we will go into deep detail of how we calculate the derivative using a modern but still simple representation of Zeno’s “The Arrow” paradox and some basic algebra. A following article will do the same for the integral using the Dichotomy paradox. Then we will tie things up by showing how the two are related, something known as The Fundamental Theorem of Calculus.

It’s a counterintuitive result that you might need to add noise to an input signal to get the full benefits from oversampling in analog to digital conversion. [Paul Allen] steps us through a simple demonstration of why this works on his blog. If you’re curious about oversampling, it’s a good read.

Oversampling helps to reduce quantization noise, which is the sampling equivalent of rounding error. In [Paul’s] one-bit ADC example, the two available output values are zero volts and one volt. Any analog signal between these two values is rounded off to either zero or one, and the resulting difference is the quantization error.

In oversampling, instead of taking the bare minimum number of samples you need you take extra samples and average them together. But as [Paul] demonstrates, this only works if you’ve got enough noise in the system already. If you don’t, you can actually make your output more accurate by adding noise on the input. That’s the counterintuitive bit.

We like the way he’s reduced the example to the absolute minimum. Instead of demonstrating how 16x oversampling can add two bits of resolution to your 10-bit ADC, it’s a lot clearer with the one-bit example.

[Paul’s] demo is great because it makes a strange idea obvious. But it got us just far enough to ask ourselves how much noise is required in the system for oversampling to help in reducing quantization noise. And just how much oversampling is necessary to improve the result by a given number of bits? (The answers are: at least one bit’s worth of noise and 2^{2B}, respectively, but we’d love to see this covered intuitively.) We’re waiting for the next installment, or maybe you can try your luck in the comment section.