## Introduction

This is the second post in the series “Why do we study x?” — from the perspective of computer engineers. The first post in the series laid down the foundation for why it is important for people not to forget foundational knowledge; knowledge about how things work, that can be used to improve on current technology and to allow them to maintain existing infrastructure when this is required.

In this post, I will specifically address the question of why it is important to study physics from the perspective of a computer engineer. In order to make the post manageable, I will divide physics into the following fields that I will talk about separately

- Newtonian Mechanics
- Electricty and Electromagnetism
- Quantum Mechanics
- Relativity

For each of these aspects of physics, I will explain why they are important for computer engineers. Let us begin our discussion with Newtonian mechanics.

## Newtonian Mechanics

The mechanics of Isaac Newton are one of the first aspects of college level physics that a computer engineer encounters — at least in the institution where I teach. What is Newtonian Mechanics? It’s the mechanical and physical laws that can be derived from Newton’s laws of motion.

These laws essentially describe how things move and act in the real-world. By adding things like friction, air drag, and fluid mechanics, they can be used to describe, to a great degree of accuracy, how most objects behave in the real-world.

Treatment of these topics at the college level are typically given using calculus — calculus based physics. The use of calculate rather than algebra allows these laws to describe the instantaneous behavior of objects, rather than their behavior “on average”. Which is probably one of the factors that causes students to ask why we need to study them — calculus is not a favorite with many people apparently.

So, how do we, as computer engineers, use these laws? Well, first there is the obvious use case of writing physics simulation programs. Scientific programs that can be used to experiment or to simulate physical objects have to have these laws baked into their code. For example, if you are going to write the software for a wind tunnel simulator, or a flight simulator, you have to have a working knowledge of Newtonian physics — note that I use this term to mean all non-relativistic physical laws of nature.

But scientific programs are not the only programs that require programmers to have knowledge of the laws of physics — games and computer generated imagery (CGI) are two other areas of programing that need working knowledge of physics.

For games, it is important to model how the real-world works in order to make sure that when, for example, a car collides with an obstacle, it responds in a reasonable way. It is also needed to model the trajectory of a bullet or the flow of water in a game. This is typically implemented in a physics engine that developers of games can use. It is impossible to write such an engine without a working knowledge of physics.

It is interesting to note that the physics engine for games may not always model exactly how the real-world works. It may be an approximation, or a deliberate divergence from the physics of the real-world to, for example, model how objects would move in space or in low gravity environments.

Of course, such engines can be written in collaboration with physicists, but a programmer with a working knowledge of Newtonian physics would greatly speed things up and ensure that the code is correctly written. Not to mention that he/she can go into the code and change anything when the game requires it. Like when adding a new level to a game that is hosted on a space station, or on a different planet, for example.

Similarly, in GCI, there must be a model of real-world physics so that the generated models can behave in a way that is realistic to the audience. They need to respond to physical events in the same way — or at least in a similar way — to how objects in the real-world would respond to them. Again, this necessitates a physics engine that models the behavior of real-world objects. The Jurassic Park movies, for example, would have been terrible had it not been possible to use a physics engine to model the interactions of the CGI dinosaurs with the real-world.

## Electricty and Electromagnetism

We can now move on to the next category of physics, electricity and electromagnetism. In addition to the previous example of writing scientific programs that can be used to model electrical circuits — think ORCAD or PSPICE — knowledge of this area of physics is essential for designing the circuits that interface the physical world to embedded systems.

You need to be able to design these circuits using the principles of electricity. For example, suppose you want to design a circuit that filters the signal from a noisy source before it is input to a processor. One possible way to do this is to design a filter using resistors, capacitors and inductors — this is called a passible filter. As you can see, without a working knowledge of electricity and circuits, it would be impossible to do this.

The entire data acquisition channel of an embedded system requires passive and active circuits — we will talk more about the later when we get to the post about the “why we study electronics?”.

Thus, this is an important field of physics that computer engineers need to be aware of. A working knowledge of this area allows us to design programs and systems that we would otherwise be incapable of doing.

## Quantum Mechanics

The strange world of quantum mechanics is also very important to computer engineers. One of the hot trends in computers, other than AI, is quantum computing. We are getting close to being able to design commercial quantum computers at scale.

While quantum mechanics may seem a very dense subject — with its talk of wave functions, quantum engagement, and other similarly weird topics — it is essential for a future proof career in computer engineering.

Just like we need to know the basics of transistors in order to be able to construct the elementary logic gates that power today’s computers — we also need to know the basics of quantum mechanics to be able to construct the basic units of quantum computers.

Just as it is important to understand the limitations imposed on computers by their current binary logic in order to be able to program them efficiently, it is important to be able to understand how the basic units of quantum computing work in order to be able to program them.

A complete understanding of, say, Shor’s algorithm, is impossible without an understanding of qubits and how they work. You must understand at least the basics of quantum mechanics to be able enter this new and promising field of quantum computing.

## Relativity

Relativity, together with quantum mechanics, is one of the more difficult fields of physics to grasp. I am sure many of you would immediately object to the notion that it would be of practical use to computer engineers — how, I can imagine you say, does a theory that has such weird concepts like time dilation and length contraction be of any practical use? Surely it is merely a theoretical framework used by physicists to find mathematical solutions to their abstract problems.

You would be wrong my friend — there are many practical uses of the theory of relativity, from nuclear energy generation, to particle accelerator design to, and this is the most important part as far as we are concerned, the design of GPS systems.

How on earth would the theory of relativity have anything to do with GPS systems? Well in order to explain this, we need to understand two concepts, one from the special theory of relativity and the other from the general theory of relativity.

The first states that a moving clock runs slower, and the second states that a clock under the influence of gravity runs slower. The corollary of the second statement is that a clock that is further away from a gravitational source runs *faster* with respect to a clock that is closer to the source of gravity.

The theories of general and special relativity allow us to calculate by exactly how much such clocks would be slower or faster. I won’t go into the details of the calculations here, but it should be noted that they depend on the speed and altitude of the object being considered.

GPS satellites, since they are in constant motion with respect to the Earth, moving at about 14,000 km/h in the case of the US system — there are Russian and European systems that move at different but similar speeds — have clocks that should run slower than clocks on Earth according to the theory of special relativity.

In addition, since the satellites are further away from the center of the Earth than the Earth’s surface, they have clocks that should run *faster* than those on Earth according to the theory of general relativity. Accounting for both these factors, they work in opposite directions, gives you the exact correction that needs to be applied to the time of the GPS clocks if they are to be accurate.

Accuracy of GPS clocks are essential for the functioning of the GPS system, and if these effects are not accounted for in the software of either the satellites, the receivers or both, the location determined by the system would be inaccurate.

So those writing the software for these systems need to take these factors into account — note that a change in the altitude or speed of the satellites would require that you do the calculations again and come up with a different correction factor. Without knowledge of special and general relativity you wouldn’t be able to perform such calculations.

If you would like a soft introduction to the concepts of relativity, I highly recommend the book mentioned in this blog post that I recently made. The author uses only high school algebra and a very engaging writing style to teach you the core concepts.

## Conclusion

So there you have it ladies and gents, a knowledge of physics is essential for computer engineers. And while you can probably get along without this knowledge, you would be an inferior engineer surpassed by those who do. Remember the point made by Isaac Asimov articulated in my previous post — failure to maintain knowledge about fundamental science is the first step towards civilizational decline. So buckle up and study your physics!