Understanding Linear Regression

Although [Vitor Fróis] is explaining linear regression because it relates to machine learning, the post and, indeed, the topic have wide applications in many things that we do with electronics and computers. It is one way to use independent variables to predict dependent variables, and, in its simplest form, it is based on nothing more than a straight line.

You might remember from school that a straight line can be described by: y=mx+b. Here, m is the slope of the line and b is the y-intercept. Another way to think about it is that m is how fast the line goes up (or down, if m is negative), and b is where the line “starts” at x=0.

[Vitor] starts out with a great example: home prices (the dependent variable) and area (the independent variable). As you would guess, bigger houses tend to sell for more than smaller houses. But it isn’t an exact formula, because there are a lot of reasons a house might sell for more or less. If you plot it, you don’t get a nice line; you get a cloud of points that sort of group around some imaginary line.

Continue reading “Understanding Linear Regression”

Deriving The Reactance Formulas

If you’ve dealt with reactance, you surely know the two equations for computing inductive and capacitive reactance. But unless you’ve really dug into it, you may only know the formula the way a school kid knows how to find the area of a circle. You have to have a bit of higher math to figure out why the equation is what it is. [Old Hack EE] wanted to figure out why the formulas are what they are, so he dug in and shared what he learned in a video you can see below.

The key to understanding this is simple. The reactance describes the voltage over the current through the element, just like resistance. The difference is that a resistance is just a single number. A reactance is a curve that gives you a different value at different frequencies. That’s because current and voltage are out of phase through a reactance, so it isn’t as easy as just dividing.

If you know calculus, the video will make a lot of sense. If you don’t know calculus, you might have a few moments of panic, but you can make it. If you think of frequency in Hertz as cycles per second, all the 2π you find in these equations convert Hz to “radian frequency” since one cycle per second is really 360 degrees of the sine wave in one second. There are 2π radians in a circle, so it makes sense.

We love developing intuition about things that seem fundamental but have a lot of depth to them that we usually ignore. If you need a refresher or a jump start on calculus, it isn’t as hard as you probably think. Engineers usually use vectors or imaginary numbers to deal with reactance, and we’ve talked about that too, if you want to learn more.

Math On A Checkerboard

The word “algorithm” can sometimes seem like a word designed to scare people away from math classes, much like the words “calculus”, “Fourier transform”, or “engineering exam”. But in reality it’s just a method for solving a specific problem, and we use them all the time whether or not we realize it. Taking a deep dive into some of the ways we solve problems, especially math problems, often leads to some surprising consequences as well like this set of algorithms for performing various calculations using nothing but a checkerboard.

This is actually a demonstration of a method called location arithmetic first described by [John Napier] in 1617. It breaks numbers into their binary equivalent and then uses those representations to perform multiplication, division, or to take the square root. Each operation is performed by sliding markers around the board to form certain shapes as required by the algorithms; with the shapes created the result can be viewed directly. This method solves a number of problems with other methods of performing math by hand, eliminating other methods like trial-and-error. The video’s creator [Wrath of Math] demonstrates all of these capabilities and the proper method of performing the algorithms in the video linked below as well.

While not a “hack” in the traditional sense, it’s important to be aware of algorithms like this as they can inform a lot of the way the world works on a fundamental level. Taking that knowledge into another arena like computer programming can often yield some interesting results. One famous example is the magic number found in the code for the video game Quake, but we’ve also seen algorithms like this used to create art as well.

Continue reading “Math On A Checkerboard”

Pi’s Evil Twin Goes For Infinity

Most people know about the numerical constant pi (or π, if you prefer). But did you know that pi has an evil twin represented by the symbol ϖ? As [John Carlos Baez] explains, it and its related functions are related to the lemniscate as pi relates to circles. What’s a lemniscate? That’s the proper name for the infinity sign (∞).

[John] shows how many of the same formulas for pi also work for the lemniscate constant (the name for ϖ). Some  (as John calls them) “mutant” trig functions use the pi-like constant.

Continue reading “Pi’s Evil Twin Goes For Infinity”

Why NASA Only Needs Pi To So Many Decimal Places

If you’re new to the world of circular math, you might be content with referring to pi as 3.14. If you’re getting a little more busy with geometry, science, or engineering, you might have tacked on a few extra decimal places in your usual calculations. But what about the big dogs? How many decimal places do NASA use?

NASA doesn’t need this many digits. It’s likely you don’t either. Image credits: NASA/JPL-Caltech

Thankfully, the US space agency has been kind enough to answer that question. For the highest precision calculations, which are used for interplanetary navigation, NASA uses 3.141592653589793 — that’s fifteen decimal places.

The reason why is quite simple, going into any greater precision is unnecessary. The article demonstrates this by calculating the circumference of a circle with a radius equal to the distance between Earth and our most distant spacecraft, Voyager 1. Using the formula C=2pir with fifteen decimal places of pi, you’d only be off on the true circumference of the circle by a centimeter or so. On solar scales, there’s no need to go further.

Ultimately, though, you can calculate pi to a much greater precision. We’ve seen it done to 10 trillion digits, an effort which flirts with the latest Marvel movies for the title of pure irrelevance. If you’ve done it better or faster, don’t hesitate to let us know!

Square Roots 1800s Style — No, The Other 1800s

[MindYourDecisions] presents a Babylonian tablet dating back to around 1800 BC that shows that the hypotenuse of a unit square is the square root of two or 1.41421. How did they know that? We don’t know for sure how they computed it, but experts think it is the same as the ancient Greek method written down by Hero. It is a specialized form of the Newton method. You can follow along and learn how it works in the video below.

The method is simple. You guess the answer first, then you compute the difference and use that to adjust your estimate. You keep repeating the process until the error becomes small enough for your purposes.

Continue reading “Square Roots 1800s Style — No, The Other 1800s”

3D Space Can Be Tiled With Corner-free Shapes

Tiling a space with a repeated pattern that has no gaps or overlaps (a structure known as a tessellation) is what led mathematician [Gábor Domokos] to ponder a question: how few corners can a shape have and still fully tile a space? In a 2D the answer is two, and a 3D space can be tiled in shapes that have no corners at all, called soft cells.

These shapes can be made in a few different ways, and some are shown here. While they may have sharp edges there are no corners, or points where two or more line segments meet. Shapes capable of tiling a 2D space need a minimum of two corners, but in 3D the rules are different.

A great example of a natural soft cell is found in the chambers of a nautilus shell, but this turned out to be far from obvious. A cross-section of a nautilus shell shows a cell structure with obvious corners, but it turns out that’s just an artifact of looking at a 2D slice. When viewed in full 3D — which the team could do thanks to a micro CT scan available online — there are no visible corners in the structure. Once they knew what to look for, it was clear that soft cells are present in a variety of natural forms in our world.

[Domokos] not only seeks a better mathematical understanding of these shapes that seem common in our natural world but also wonders how they might relate to aperiodicity, or the ability of a shape to tile a space without making a repeating pattern. Penrose Tiles are probably the most common example.