This book is published open access under a CC BY 4.0 license. This book presents computer programming as a key method for solving mathematical problems. This second edition of the well-received book has been extensively revised: All code is now written in Python version 3.6 (no longer version 2.7). In addition, the two first chapters of the previous edition have been extended and split up into five new chapters, thus expanding the introduction to programming from 50 to 150 pages. Throughout the book, the explanations provided are now more detailed, previous examples have been modified, and new sections, examples and exercises have been added. Also, a number of small errors have been corrected.
The book was inspired by the Springer book TCSE 6: A Primer on Scientific Programming with Python (by Langtangen), but the style employed is more accessible and concise, in keeping with the needs of engineering students. The book outlines the shortest possible path from no previous experience with programming to a set of skills that allows students to write simple programs for solving common mathematical problems with numerical methods in the context of engineering and science courses. The emphasis is on generic algorithms, clean program design, the use of functions, and automatic tests for verification.