Making Floating Point Calculations Less Cursed When Accuracy Matters

Inverting the earlier exponentiation to reduce floating point arithmetic error. (Credit: exozy)
Inverting the earlier exponentiation to reduce floating point arithmetic error. (Credit: exozy)

An unfortunate reality of trying to represent continuous real numbers in a fixed space (e.g. with a limited number of bits) is that this comes with an inevitable loss of both precision and accuracy. Although floating point arithmetic standards – like the commonly used IEEE 754 – seek to minimize this error, it’s inevitable that across the range of a floating point variable loss of precision occurs. This is what [exozy] demonstrates, by showing just how big the error can get when performing a simple division of the exponential of an input value by the original value. This results in an amazing error of over 10%, which leads to the question of how to best fix this.

Obviously, if you have the option, you can simply increase the precision of the floating point variable, from 32-bit to 64- or even 256-bit, but this only gets you so far. The solution which [exozy] shows here involves using redundant computation by inverting the result of ex. In a demonstration using Python code (which uses IEEE 754 double precision internally), this almost eradicates the error. Other than proving that floating point arithmetic is cursed, this also raises the question of why this works.

Continue reading “Making Floating Point Calculations Less Cursed When Accuracy Matters”

Integration Taught Correctly

[Math the World] claims that your calculus teacher taught you integration wrong. That’s assuming, of course, you learned integration at all, and if you haven’t forgotten it. The premise is that most people think of performing an integral as finding the area under a curve or as the “antiderivative.” However, fewer people think of integration as adding up many small parts. The video asserts that studies show that students who don’t understand the third definition have difficulty applying integration to real-world problems.

We aren’t sure that’s true. People who write software have probably looked at numerical integration like Simpson’s rule or the midpoint rule. That makes it pretty obvious that integration is summing up small bits of something. However, you usually learn that very early, so you’re forgiven if you didn’t get the significance of it at the time.

Continue reading “Integration Taught Correctly”

Calculus Made Easy In The Car

If you had the traditional engineering education, you’ve made your peace with calculus. If you haven’t, you may have learned it on your own, but for many people, calculus has a reputation for being super difficult. While some of the details can be very tricky, the core concepts are actually simple and [Mathologer] has a very simple explanation along with some good graphics that can help you get started on calculus mastery if you’ve been putting it off. Using a car on the highway as the prototypical example, he covers quite a bit of ground in the 30 minute video that you can see below.

Of course, this isn’t a unique idea that calculus is actually simple. The video credits the great book “Calculus Made Easy” that we’ve talked about before. That 100-year-old (and then some) book has a similar approach to the topic.

Continue reading “Calculus Made Easy In The Car”

Hackaday Links Column Banner

Hackaday Links: July 10, 2022

We always like to call out a commercial success stemming from projects that got their start on Hackaday.io, and so we’re proud to announce the release of MAKE: Calculus by Joan Horvath and Rich Cameron, a book that takes a decidedly different approach to teaching calculus than traditional courses. Geared to makers and hackers, who generally tend to have a visual style of learning, the book makes heavy use of 3D-printed models to illustrate the relationships between functions. The project started five years ago as a 2017 Hackaday Prize entry, and resulted in a talk at the 2019 Supercon. Their book is now available for preorder, and might be a great way to reacquaint themselves with calc, or perhaps even to learn it for the first time. Continue reading “Hackaday Links: July 10, 2022”

Talking Head Teaches Laplace Transform

Most people who deal with electronics have heard of the Fourier transform. That mathematical process makes it possible for computers to analyze sound, video, and it also offers critical math insights for tasks ranging from pattern matching to frequency synthesis. The Laplace transform is less familiar, even though it is a generalization of the Fourier transform. [Steve Bruntun] has a good explanation of the math behind the Laplace transform in a recent video that you can see below.

There are many applications for the Laplace transform, including transforming types of differential equations. This comes up often in electronics where you have time-varying components like inductors and capacitors. Instead of having to solve a differential equation, you can perform a Laplace, solve using common algebra, and then do a reverse transform to get the right answer. This is similar to how logarithms can take a harder problem — multiplication — and change it into a simpler addition problem, but on a much larger scale.

Continue reading “Talking Head Teaches Laplace Transform”

Understanding Math Rather Than Merely Learning It

There’s a line from the original Star Trek where Khan says, “Improve a mechanical device and you may double productivity, but improve man and you gain a thousandfold.” Joan Horvath and Rich Cameron have the same idea about improving education, particularly autodidacticism or self-learning. They share what they’ve learned about acquiring an intuitive understanding of difficult math at the Hackaday Superconference and you can watch the newly published video below.

The start of this was the pair’s collaboration on a book about 3D printing science projects. Joan has a traditional education from MIT and Rich is a self-taught guy. This gave them a unique perspective from both sides of the street. They started looking at calculus — a subject that scares a lot of people but is really integral (no pun intended) to a lot of serious science and engineering.

You probably know that Newton and Leibniz struck on the fundamentals of calculus about the same time. The original papers, however, were decidedly different. Newton’s approach was more physical and less mathematical. Leibniz used formal logic and algebra. Although both share credit, the Leibniz notation won out and is what we use today.

Continue reading “Understanding Math Rather Than Merely Learning It”

Calculus In 20 Minutes

If you went to engineering school, you probably remember going to a lot of calculus classes. You may or may not remember a lot of calculus. If you didn’t go to engineering school, you will find that there’s an upper limit to how much electronics theory you can learn before you have to learn calculus. Now imagine Khan Academy, run by an auctioneer and done without computers. Well, you don’t have to imagine it. Thinkwell has two videos that purport to teach you calculus in twenty minutes (YouTube, embedded below).

We are going to be honest. If you need a refresher, these videos might be useful. If you have no idea how to do calculus, maybe these are going to whiz by a little fast. However, either way, the videos have some humor value both from the FedEx commercial-style delivery to the non-computerized graphics (not to mention the glass-breaking sound effects). Of course, the video is about ten years old, but that’s part of its charm.

Continue reading “Calculus In 20 Minutes”