I've always done scientific computing using Fortran but got curious and did some projects with Python. I learned Python using online references. Now as I read through this Primer I realize how many essential details I missed by gathering information randomly off the internet. This book presents material clearly and in a comprehensive and logical manner.
Note that the emphasis is on teaching Python rather than numerical methods. If your main focus is to learn techniques for scientific computing then you should look for a different book.
Python is a good language for learning to use object-oriented programming (OOP) and this book will make that easy. On the other hand, the author didn't quite convince me that this approach is useful for scientific programming (but OOP is clearly quite useful elsewhere).
Overall I found the book very helpful - highly recommended.
Author(s): Hans Petter Langtangen
Series: Texts in Computational Science and Engineering
Edition: 1
Publisher: Springer
Year: 2009
Language: English
Commentary: +OCR
Pages: 726
Cover Page......Page 1
General Remarks......Page 2
Series Editors......Page 3
Lecture Notes in Computational Science and Engineering......Page 4
Editors......Page 8
Title: A Primer on Scientific Programming with Python......Page 9
ISBN 978-3642024740......Page 10
Preface......Page 11
Contents......Page 15
List of Exercises......Page 25
1.1 The First Programming Encounter: A Formula......Page 34
1.2 Computer Science Glossary......Page 46
1.3 Another Formula: Celsius-Fahrenheit Conversion......Page 51
1.4 Evaluating Standard Mathematical Functions......Page 55
1.5 Interactive Computing......Page 59
1.6 Complex Numbers......Page 64
1.7 Summary......Page 68
1.8 Exercises......Page 73
2.1 Loops and Lists for Tabular Data......Page 84
2.2 Functions......Page 104
2.3 If Tests......Page 121
2.4 Summary......Page 124
2.5 Exercises......Page 132
3 Input Data and Error Handling......Page 152
3.1 Asking Questions and Reading Answers......Page 153
3.2 Reading from the Command Line......Page 160
3.3 Handling Errors......Page 165
3.4 A Glimpse of Graphical User Interfaces......Page 172
3.5 Making Modules......Page 174
3.6 Summary......Page 183
3.7 Exercises......Page 193
4 Array Computing and Curve Plotting......Page 202
4.1 Vectors......Page 203
4.2 Arrays in Python Programs......Page 208
4.3 Curve Plotting......Page 212
4.4 Plotting Difficulties......Page 232
4.5 More on Numerical Python Arrays......Page 240
4.6 Higher-Dimensional Arrays......Page 246
4.7 Summary......Page 252
4.8 Exercises......Page 258
5 Sequences and Difference Equations......Page 268
5.1 Mathematical Models Based on Difference Equations......Page 269
5.2 Programming with Sound......Page 286
5.3 Summary......Page 289
5.4 Exercises......Page 293
6.1 Reading Data from File......Page 302
6.2 Dictionaries......Page 311
6.3 Strings......Page 324
6.4 Reading Data from Web Pages......Page 333
6.5 Writing Data to File......Page 341
6.6 Summary......Page 350
6.7 Exercises......Page 356
7 Introduction to Classes......Page 370
7.1 Simple Function Classes......Page 371
7.2 More Examples on Classes......Page 385
7.3 Special Methods......Page 389
7.4 Example: Solution of Differential Equations......Page 405
7.5 Example: Class for Vectors in the Plane......Page 411
7.6 Example: Class for Complex Numbers......Page 415
7.7 Static Methods and Attributes......Page 422
7.8 Summary......Page 424
7.9 Exercises......Page 430
8 Random Numbers and Simple Games......Page 450
8.1 Drawing Random Numbers......Page 451
8.2 Drawing Integers......Page 457
8.3 Computing Probabilities......Page 465
8.4 Simple Games......Page 473
8.5 Monte Carlo Integration......Page 476
8.6 Random Walk in One Space Dimension......Page 480
8.7 Random Walk in Two Space Dimensions......Page 486
8.8 Summary......Page 489
8.9 Exercises......Page 496
9.1 Inheritance and Class Hierarchies......Page 512
9.2 Class Hierarchy for Numerical Differentiation......Page 521
9.3 Class Hierarchy for Numerical Integration......Page 532
9.4 Class Hierarchy for Numerical Methods for ODEs......Page 541
9.5 Class Hierarchy for Geometric Shapes......Page 558
9.6 Summary......Page 571
9.7 Exercises......Page 579
A.1 Discrete Functions......Page 606
A.2 Differentiation Becomes Finite Differences......Page 612
A.3 Integration Becomes Summation......Page 616
A.4 Taylor Series......Page 622
A.5 Exercises......Page 632
B - Differential Equations......Page 638
B.1 The Simplest Case......Page 639
B.2 Exponential Growth......Page 641
B.3 Logistic Growth......Page 645
B.4 A General Ordinary Differential Equation......Page 647
B.5 A Simple Pendulum......Page 648
B.6 A Model for the Spread of a Disease......Page 652
B.7 Exercises......Page 654
C - A Complete Project......Page 658
C.1 About the Problem: Motion and Forces in Physics......Page 659
C.2 Program Development and Testing......Page 665
C.3 Visualization......Page 672
C.4 Exercises......Page 682
D.1 Using a Debugger......Page 684
D.2 How to Debug......Page 686
E.1 Different Ways of Running Python Programs......Page 702
E.2 Integer and Float Division......Page 706
E.3 Visualizing a Program with Lumpy......Page 707
E.4 Doing Operating System Tasks in Python......Page 708
E.5 Variable Number of Function Arguments......Page 711
E.6 Evaluating Program E ciency......Page 716
References......Page 720
Index......Page 722