Calculus Is Not As Hard As You Think

“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.

Zeno of Elea 430 - 490BC
Zeno of Elea 490 – 430BC

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

zeno_03Consider 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

zeno_02Let 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

zeno_04In 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.

zeno_05

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.

A Short History Of AI, And Why It’s Heading In The Wrong Direction

Sir Winston Churchill often spoke of World War 2 as the “Wizard War”. Both the Allies and Axis powers were in a race to gain the electronic advantage over each other on the battlefield. Many technologies were born during this time – one of them being the ability to decipher coded messages. The devices that were able to achieve this feat were the precursors to the modern computer. In 1946, the US Military developed the ENIAC, or Electronic Numerical Integrator And Computer. Using over 17,000 vacuum tubes, the ENIAC was a few orders of magnitude faster than all previous electro-mechanical computers. The part that excited many scientists, however, was that it was programmable. It was the notion of a programmable computer that would give rise to the ai_05idea of artificial intelligence (AI).

As time marched forward, computers became smaller and faster. The invention of the transistor semiconductor gave rise to the microprocessor, which accelerated the development of computer programming. AI began to pick up steam, and pundits began to make grand claims of how computer intelligence would soon surpass our own. Programs like ELIZA and Blocks World fascinated the public and certainly gave the perception that when computers became faster, as they surely would in the future, they would be able to think like humans do.

But it soon became clear that this would not be the case. While these and many other AI programs were good at what they did, neither they, or their algorithms were adaptable. They were ‘smart’ at their particular task, and could even be considered intelligent judging from their behavior, but they had no understanding of the task, and didn’t hold a candle to the intellectual capabilities of even a typical lab rat, let alone a human.

Continue reading “A Short History Of AI, And Why It’s Heading In The Wrong Direction”

SRF01 Ultrasonic Sensor Teardown

The SRF01 is a popular ultrasonic sensor used primarily for range finding applications. [Jaanus] discovered that they had a few flaws, including not working after being dropped. The faulty ones began to pile up, so he decided sensor_01to tear one apart and put his engineering skills to use.

The SRF01 is unique in that it only uses a single transducer, unlike the SRF04, which uses two. Using only one transducer presents a problem when measuring very close distances. The transducer emits a pulse of sound and then must listen for the echo. The smaller the distance, the smaller the time interval between the pulse and when the echo returns. There is a fundamental limit to this time as the transducer has to recover from what is known as ringing. [Jaanus] discovered that the SRF01 solves the ringing problem with the use of a PIC24’s ADC and its 500 ksps (kilosamples per second) rate. This allows it to measure very close distances.

Be sure to check out the teardown for more details on how the SRF01 works.

Hacker Uncovers Security Holes At CSL Dualcom

CSL Dualcom, a popular maker of security systems in England, is disputing claims from [Cybergibbons] that their CS2300-R model is riddled with holes. The particular device in question is a communications link that sits in between an alarm system and their monitoring facility. Its job is to allow the two systems to talk to each other via internet, POT lines or cell towers. Needless to say, it has some heavy security features built in to prevent alarm_01tampering. It appears, however, that the security is not very secure. [Cybergibbons] methodically poked and prodded the bits and bytes of the CS2300-R until it gave up its secrets. It turns out that the encryption it uses is just a few baby steps beyond a basic Caesar Cipher.

A Caesar Cipher just shifts data by a numeric value. The value is the cipher key. For example, the code IBDLBEBZ is encrypted with a Caesar Cipher. It doesn’t take very much to see that a shift of “1” would reveal HACKADAY. This…is not security, and is equivalent to a TSA lock, if that. The CS2300-R takes the Caesar Cipher and modifies it so that the cipher key changes as you move down the data string. [Cybergibbons] was able to figure out how the key changed, which revealed, as he put it – ‘the keys to the kingdom’.

There’s a lot more to the story. Be sure to read his detailed report (pdf) and let us know what you think in the comments below.

We mentioned that CSL Dualcom is disputing the findings. Their response can be read here.

Resurrecting Duckhunt

Bringing old things back to life holds a great sense of joy for most people. The never ending pursuit of recapturing our youth leads us down roads we’ve long forgotten. Along the way, we tend to bump into forgotten memories which jostle other forgotten memories which allows us to relive happy times we haven’t thought of in years, sometimes even decades. For some, the roar of a 351 small block sweeps them back to high school and the fast nights of cruising down main street with the FM radio cranked up as high as it would go.  For those of us who were born in the 80’s and 90’s, video games can bring back such memories. Who among us can forget our first encounter with Link, the elegant theme music of Final Fantasy or up-up-down-down-left-right-left-right-b-a-select-start?

Advances in processor technology has allowed us to relive our favorite games via emulators – programs that emulate processors of older computers. The games are ‘dumped’ from the ROM chips (where they are stored) into files. These game files can then be loaded into the emulator program, which allows you to play the game as if you were playing it on the original system.

NES_02
Guts of NES Zapper

Technology is truly a beautiful thing. It allows us to move forward, allows us to do today that which was not possible yesterday. There are a few cases, however, where this paradigm does not hold true. One of these has to do with the Nintendo Entertainment System and its “Zapper” gun controller. The NES was the most popular game console of its time, and rightfully so. From the minds of Nintendo engineers, programmers and audio experts came some of the best video games ever made. Unfortunately, some of these great games cannot be played on your Raspberry Pi favorite emulator due to the incompatibility of the Zapper gun and modern digital monitors.  None of us can forget the fun that Duckhunt brought. The game came as standard issue with all NES systems, so we’ve all played it. But its nostalgia is currently entombed by a technological quirk that has yet to be solved.

From one hacker to another – this can no longer be tolerated. First, we’re going to learn how the Zapper works and why it doesn’t work with digital displays. Then we’re going to fix it.

Continue reading “Resurrecting Duckhunt”

What Do Bertlmann’s Socks Mean To The Nature Of Reality?

One can be reasonably certain that when the title of an article includes the phrase “The Nature of Reality”, thought provoking words must surely lie ahead.  But when that same title seems to inquire about a gentleman’s socks,  coupled with an image of said gentleman’s socks which happen to be mismatched and reflect very loud colors , one might be moved in a direction which suggests the article is not of a serious nature. Perhaps even some sort of parody.

It is my hope that you will be pleasantly surprised with the subtle genius of Irish physicist [John Bell] and his use of socks, washing machines, and a little math to show how we can test one of quantum physic’s most fundamental properties. A property that does indeed reside in the very nature of the reality we are a part of. Few people can say they understand the Bell Inequality down to its most fundamental level. Give me a little of your time, and you will be counted among these few.

Continue reading “What Do Bertlmann’s Socks Mean To The Nature Of Reality?”

Who Is Responsible When Machines Kill?

This morning I want you to join me in thinking a few paces into the future. This mechanism let’s us discuss some hard questions about automation technology. I’m not talking about thermostats, porch lights, and coffee makers. The things that we really need to think about are the machines that can cause harm. Like self-driving cars. Recently we looked at the ethics behind decisions made by those cars, but this is really just the tip of the iceberg.

A large chunk of technology is driven by military research (the Internet, the space race, bipedal robotics, even autonomous vehicles through the DARPA Grand Challenge). It’s easy to imagine that some of the first sticky ethical questions will come from military autonomy and unfortunate accidents.

Continue reading “Who Is Responsible When Machines Kill?”