Scientific computing with confidence using typed dimensions

submited by
Style Pass
2024-11-21 10:30:03

Until the end of undergraduate school, this was mostly done by hand. Optimizing the trajectory of a heavy ball or solving the heat equation are problems with analytical solutions, and thus can be solved with pen(cil) and paper.

However, there were instances when numerical tools had to be used, rather than analytical ones. This occurred, for example, when replacing models of the physical world with measurements from the physical world in experimental physics classes. By the end of my B.Sc., the need to take measurements, transform them, and report results was made much simpler by using a computer.

Fast forward to graduate school, and the amount of measurements (and their complexity) require the use of some of the most powerful computers I have ever used, even to this day. When implementing numerical routines, I had to pore over the equations (translated to computer expression) countless times, to ensure that they were correctly applied. Most importantly, all units needed to be carefully checked by hand. Small mistakes went unnoticed and wasted valuable resources. Take a look at one of the computations from my Ph. D. dissertation (PDF, Git repository):

This isn’t a complex equation, but it showcases the problem perfectly. temperature, frequency, h, and kb are all floating-point numbers, with their units attached as documentation. This is not robust.

Leave a Comment