If you earned your engineering degree before the early 1990s, you never learned about the Python programming language in school. For those not familiar with Python who want to rectify that situation, Hardcore Programming for Mechanical Engineers might be a book to consider. It is about solving engineering problems with Python. In that Python is generally ranked among the top few programming languages in terms of popularity, the solution of engineering problems with Python might be an area worth investigating.
The book devotes a significant number of its pages to coding geometric primitives that serve as the basis of more complex operations, how to create vector images and animated sequences to present results, and how to solve large systems of linear equations. The final chapters cover the solution of truss structure problems.
The book also assumes the reader has a background in engineering and mathematics. The word Hardcore in the book title refers to the fact that the text has readers writing their own Python code as a learning exercise rather than relying only on the Python standard libraries or third-party libraries to solve equations or draw vector images. That said, all the code is available on Github.
The first part of Hardcore covers a lot of Python basics. Authors of books like Hardcore, which aren’t designed as basic language primers, often have bit of a conundrum about deciding what level of programming knowledge readers need to understand the book. Hardcore author Angel Sola Orbaiceta expects readers to have “a basic understanding of the language.” But the first three chapters and a 30-page introduction are devoted to explaining fundamental Python concepts such as tuples, modules, packages, relative imports, docstrings, and so forth.
In a nutshell, the first chapters seem to be there to make sure readers are all on the same page of the playbook for the next section which goes into 2D geometry programming. Notably, this section includes a discussion of affine transformations, the mathematical constructs that allow panning, zooming, and rotating of geometrical figures as commonly takes place in CAD programs. If you’ve ever wondered how these operations happen, you’ll know once you’ve completed this chapter. After four more chapters on vector images, user interfaces, and graphical simulations, readers learn how to animate affine transformations.
Two chapters are devoted to solving matrices and linear equations with a fair amount of material on numerical methods. These concepts get put to work in the last section of the book on truss structures and structural models.
All in all, engineers with pressure-volume problems or knotty dynamics issues may find Hardcore to be a good introduction but not quite on point. For mechanical engineers working with engineering drawings and statics, there’s a lot to like.