Computer Related / Education

Multi-dimensional, dynamically sized arrays in C (and C++) the right way

Die shot of the 2023 Intel Meteor Lake architecture.

Recently a Twitter user posted a project they had been working on where they implemented a multi-dimensional array to store frames of a movie. They used the variable int ****video to store this data, and were immediately mocked by software Twitter. This is definitely the wrong way to do multi-dimensional arrays, but I’ve also seen material, even textbooks, that incorrectly teach it this way. I can easily imagine the above-mentioned Twitter user was simply taught wrong. (In fact, I think it’s very likely.) So today I want to talk about the correct way to do multi-dimensional, dynamically sized arrays

Mathematics / Physics / Science And Math

Heat, Chaos, and Predictability

A funny comic about the butterfly effect

The butterfly effect, shown comically in figure 1, is the idea that a very small change in one place on Earth can cause a very big change somewhere else. In this case, a butterfly flaps its wings and causes a tornado. This metaphor illustrates the mathematical concept of chaos, in which the Earth’s atmosphere is a chaotic system. While a single butterfly probably isn’t literally responsible for a tornado, mathematical chaos is very real and important. So this week, I’m going to try giving you some intuition for the butterfly effect using one extreme example from physics. Heat Suppose

Physics / Relativity / Science And Math

General Relativity is the Dynamics of Distance

kogler crazy art installation

This is part two in a many-part series on general relativity. Last time, I described how Galileo almost discovered general relativity. In particular, I told you that gravity isn’t a force. In fact, gravity is the same as acceleration. Now, this is a completely crazy idea. After all, we’re all sitting in the gravitational field of the Earth right now, but we don’t feel like we’re moving, let alone accelerating. But let’s take this crazy idea at face value and see where it leads us. (Of course, the Earth is spinning, which is an acceleration. And it’s orbiting the sun,

Astrophysics / Physics / Science And Math

Pope Francis says Evolution and the Big Bang are Compatible with Catholicism

You’ve probably heard, the news. Pope Francis has announced that Big Bang cosmology and evolutionary theory are compatible with Catholicism and “may even be required.” This is, of course, wonderful news. It’s evidence that science and religion are not necessarily incompatible and that people of faith can modify their beliefs based on the evidence around them. But it should have been this way all along. Indeed, it originally _was_ this way. One of the people who developed Big Bang cosmology, Monseigneur Georges Henri Joseph Édouard Lemaître was a catholic priest who believed that his studies of physics brought him

Computer Related / logic / Mathematics / etc.

The Turing Machine

This is the sixth part in my multi-part series on computing. In the previous parts, we learned about Boolean logic, the language computers think in. We then learned how to implement this logic electronically. And finally, we learned how to make computer memory, so that computers can record results of calculations. Now before we conclude the series, we’re going to take a quick detour into computational theory and the Turing machine. Alan Turing’s Machine of the Mind In 1936, mathematician, WWII codebreaker, and all around awesome guy Alan Turing wanted to investigate a problem in formal logic. Specifically, he

Computer Related / Electronics / logic / etc.

The Boolean Circuit and Electronic Logic, Part 2

If the presence of electricity can be made visible in any part of the circuit, I see no reason why intelligence may not be transmitted instantaneously by electricity. ~Samuel Morse This is the fourth part in my multi-part series on how computers work. Computers are thinking machines, but they can’t do this on their own. We need to teach them how to think. And for this, we need a language of logic. In the first part of the series, I introduced this language of logic, Boolean algebra. In the second part, I described how to formulate complex logical statements

logic / Mathematics / Science And Math

George Boole and the Language of Logic, Part 2

Anything that thinks logically can be fooled by something else that thinks at least as logically as it does. ~Douglas Adams This is the second post in a multi-part series explaining how computers work. A computer is a thinking machine, a device which applies logic to any problem we ask it to. However, computers don’t know how to do this automatically. We have to teach them. And to teach them, we need a language of logic. Last time, we introduced one such language of logic, Boolean algebra. This time, we learn how to make composite statements in Boole’s system.

abstract algebra / logic / Mathematics / etc.

George Boole and the Language of Logic, Part 1

Logic takes care of itself; all we have to do is to look and see how it does it. ~Ludwig Wittgenstein Contrariwise, if it was so, it might be; and if it were so, it would be; but as it isn’t, it ain’t. That’s logic. ~Lewis Carroll This is the first post in a multi-part series explaining how computers work. At its heart, a computer is a logical-thinking machine. It’s very good at starting with several assumptions and deducing a conclusion from those assumptions. Of course, a computer can’t do any of that on its own. We need to

Mathematics / probability / Science And Math

Throwing Darts for Pi

The ancient Greeks defined the number as the ratio of the circumference of a circle to its diameter. Since then we’ve discovered that is incredibly important. It appears everywhere in physics, mathematics, and engineering. But how does one calculate it? is an irrational number, so it’s impossible to calculate perfectly precisely. Nevertheless, it’s important to have an accurate approximation. The Greeks originally calculated by taking a piece of rope or twine of known length, bending it into the shape of a circle and comparing the diameter of the circle to the length of the twine. Since then, many many

abstract algebra / History / Mathematics / etc.

International Women’s Day Spotlight: Emmy Noether

The connection between symmetries and conservation laws is one of the great discoveries of twentieth century physics . But I think very few non-experts will have heard either of it or its maker[:] Emily Noether, a great German mathematician. But it is as essential to twentieth century physics as famous ideas like the impossibility of exceeding the speed of light. It is not difficult to teach Noether’s theorem, as it is called; there is a beautiful and intuitive idea behind it. I’ve explained it every time I’ve taught introductory physics. But no textbook at this level mentions it. And