European Mathematical Society - Hans Petter Langtangen
https://euro-math-soc.eu/author/hans-petter-langtangen
enA Primer on Scientific Programming with Python (5th ed.)
https://euro-math-soc.eu/review/primer-scientific-programming-python-5th-ed
<div class="field field-name-field-review-review field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><div class="tex2jax"><p>
While teaching, computers have become a very useful tool. For mathematics in particular, the analysis is often used and illustrated by actually computing something, an equation that can be solved analytically or numerically, integrals and derivatives can be evaluated, models for physical, chemical, or biological systems are used for simulations, etc. Popular languages for symbolic computing are maple and mathematica, and when it it becomes numerical, certainly matlab, and for more advanced problems one may use fortran, C, or any of its variants and there are many other languages around that are used for a first course in computer programming, although to all of them are equally suitable for mathematical applications. There is a fuzzy boundary between the use of such a program just for the illustration of a mathematical definition or algorithm on one side and on the other side learning to program, i.e., where the computer science aspect rather than the mathematics is the main goal. The latter does not need mathematics and can be illustrated with typical computer science algorithms like sorting, or string manipulation, or searching in a list, etc. In a mathematics educational context, it is clearly most efficient to combine both and illustrate the programming aspects with familiar mathematical examples and at the same time illustrate how programming can push the mathematical simulation beyond the limit of computation with pen and paper. That combination is the choice made in this book. And of course in the background there is the pure technical aspect of learning the semantics and the syntax of the language too, which in this case is Python.</p>
<p>
Python is certainly one of these languages which, besides of allowing to program the solution of mathematical problems, is also fit for use as a first introduction to computer science aspects. It is particularly popular because it is freely available, it can be used interactively (style matlab, maple and the likes) as a scripting language and it has all the advanced features that one would expect from a modern computer language. An extra advantage is that it can easily be linked with software written in other languages.</p>
<p>
The latter is in important aspect because computer programs to perform standard tasks or solve numerical problems are around since the middle of the 20th century and many powerful packages are available. Part of the success of a (new) computer language will depend on the fact that it runs for free on many different platforms, that the learning curve is not too steep, and that existing software can still be used. Python obviously is a language satisfying these criterions and moreover it has native constructs like objects and classes, so that also from a computer science viewpoint, it is interesting to introduce the student to something more than just while or for loops and if-then-else constructions.</p>
<p>
This is already the fifth edition of the book, so it has been polished for a number of years. Although Python 3 has been around for a while, Lantangen has chosen to still keep his 2.7 version, basically to keep the large amount of software what is already available for version 2. One has to check every line of the existing software to migrate to version 3 because some features behave differently in Python 2 and Python 3. There is however an automatic tool to convert from Python 2.7 to Python 3.5. Hence the choice that Lantangen made here is not a strong restriction, but I am sure the migration will be made in a future edition.</p>
<p>
It is a textbook with many examples and many exercises, printed on 945 glossy pages. It requires a table or a desk to read because 2.2 kg is not easily manageable in your hands or on your lap. It is not intended to be a first course in programming, nor is it a first course in numerical mathematics. The reader should at least be familiar with the basics of programming. As Lantangen states in the introduction, it is the main intention to learn the student to <em>think</em> as a programmer should so that he or she can produce programs in a quicker and more reliable way. What Lantangen does not mention, perhaps because it is obvious, is that most effort will go into learning the syntax and the behavior of the computer language Python, or Python 2.7 to be more precise, but remarks usually indicate when there is a difference with Python 3.</p>
<p>
When this is used in the context of a course, all the necessary software will have been installed, but a technical appendix explains how to do it on your own machine if necessary, whether it is Linux, Mac, or Windows. Packages like IPython (for interactive use), NumPy (numerics), MatplotLib (matlab-style plotting), sciPython (scientific computing), and possibly Cython (C-expressions) are also used and should be installed too (although Cython is only used in an appendix). The software is absolutely necessary because you can only learn a language by using it. Since there is a lot of software in the examples of this book it is only reasonable that also this code can be downloaded. It is available from the author's github site <a href="http://hplgit.github.io/scipro-primer/">http://hplgit.github.io/scipro-primer/</a>.</p>
<p>
The contents of the book follows the usual steps from elementary operations and formulas, to loops, branching, and input-output operations, meanwhile introducing the different data types (scalars, lists, objects, functions, arrays, dictionaries, strings). Plotting is not so elementary, but some knowledge of plotting with matlab will make it easy by using the MatplotLib package. Classes and working with them (object oriented programming) are less elementary but have now become standard in computer science so this is introduced in the last chapter.</p>
<p>
All the concepts are illustrated using relatively simple examples that are mostly mathematical. An exception to that is the chapter on random numbers, stochastic processes and games. It precedes the last chapter on object oriented programming but does not introduce new programming ideas. It is more applied, rounding up and illustrating all that has been introduced so far. It consists mainly of a collection of less elementary examples. This "rounding up" idea is a feature also used at the end of each chapter, summarizing all the new concepts of the chapter. Following the last chapter is and extensive list of appendices where the mathematical concepts are more important than the software concepts, although still elementary in view of the target readership: Newton iteration, differential equations, even a whole project of a mass-spring oscillator. This project includes everything from modelling the physics till plotting of the result. Another appendix illustrates the use of classes to design an extensive ODE package. There is another appendix on debugging and one on exporting Python code to Cython.</p>
<p>
This book gives a thorough course to learn Python, and yet it is all brought at the level of a first year at the university. The fact that each concept is introduced with an example is essential. It is not a description of the language, it is a description of how the language is used, which is a very natural approach. Of course how well and how quick the student will be mastering Python will mainly depend on how much experimenting she will do. And that is where the many exercises will help to push the student to just do that and learn to avoid the pitfalls of the semantic and syntactic idiosyncrasies of a new programming language.</p>
</div></div></div></div><div class="field field-name-field-review-reviewer field-type-text field-label-inline clearfix"><div class="field-label">Reviewer: </div><div class="field-items"><div class="field-item even">Adhemar Bultheel</div></div></div><div class="field field-name-field-review-desc field-type-text-long field-label-hidden"><div class="field-items"><div class="field-item even"><div class="tex2jax"><p>
This is a fairly complete treatment the Python programming language. It discusses the different constructs by example, which are typically (numerical) mathematical examples that would perfectly fit into a first years calculus course.</p>
</div></div></div></div><span class="vocabulary field field-name-field-review-author field-type-taxonomy-term-reference field-label-inline clearfix"><h2 class="field-label">Author: </h2><ul class="vocabulary-list"><li class="vocabulary-links field-item even"><a href="/author/hans-petter-langtangen" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Hans Petter Langtangen</a></li></ul></span><span class="vocabulary field field-name-field-review-publisher field-type-taxonomy-term-reference field-label-inline clearfix"><h2 class="field-label">Publisher: </h2><ul class="vocabulary-list"><li class="vocabulary-links field-item even"><a href="/publisher/springer-verlag-0" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">springer verlag</a></li></ul></span><div class="field field-name-field-review-pub field-type-number-integer field-label-inline clearfix"><div class="field-label">Published: </div><div class="field-items"><div class="field-item even">2016</div></div></div><div class="field field-name-field-review-isbn field-type-text field-label-inline clearfix"><div class="field-label">ISBN: </div><div class="field-items"><div class="field-item even">978-3-662-49886-6 (hbk)</div></div></div><div class="field field-name-field-review-price field-type-text field-label-inline clearfix"><div class="field-label">Price: </div><div class="field-items"><div class="field-item even">74.19 € (hbk)</div></div></div><div class="field field-name-field-review-pages field-type-number-integer field-label-inline clearfix"><div class="field-label">Pages: </div><div class="field-items"><div class="field-item even">945</div></div></div><span class="vocabulary field field-name-field-review-class field-type-taxonomy-term-reference field-label-hidden"><ul class="vocabulary-list"><li class="vocabulary-links field-item even"><a href="/imu/numerical-analysis-and-scientific-computing" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Numerical Analysis and Scientific Computing</a></li></ul></span><div class="field field-name-field-review-website field-type-text field-label-hidden"><div class="field-items"><div class="field-item even"><a href="http://www.springer.com/gp/book/9783662498866" title="Link to web page">http://www.springer.com/gp/book/9783662498866</a></div></div></div><span class="vocabulary field field-name-field-review-msc field-type-taxonomy-term-reference field-label-hidden"><ul class="vocabulary-list"><li class="vocabulary-links field-item even"><a href="/msc/68-computer-science" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">68 Computer science</a></li></ul></span><span class="vocabulary field field-name-field-review-msc-full field-type-taxonomy-term-reference field-label-hidden"><ul class="vocabulary-list"><li class="vocabulary-links field-item even"><a href="/msc-full/68n01" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">68N01</a></li></ul></span><span class="vocabulary field field-name-field-review-msc-other field-type-taxonomy-term-reference field-label-hidden"><ul class="vocabulary-list"><li class="vocabulary-links field-item even"><a href="/msc-full/67n80" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">67N80</a></li></ul></span>Mon, 08 Aug 2016 12:18:02 +0000Adhemar Bultheel47101 at https://euro-math-soc.euhttps://euro-math-soc.eu/review/primer-scientific-programming-python-5th-ed#comments