Python Scripting for Computational Science and over 2 million other books are available for Amazon Kindle . Learn more

Sign in to turn on 1-Click ordering.
Trade in Yours
For a 10.22 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Sorry, this item is not available in
Image not available for
Image not available

Start reading Python Scripting for Computational Science on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Python Scripting for Computational Science (Texts in Computational Science and Engineering) [Hardcover]

Hans Petter Langtangen

RRP: 44.99
Price: 35.88 & FREE Delivery in the UK. Details
You Save: 9.11 (20%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In stock on September 23, 2014.
Order it now.
Dispatched from and sold by Amazon. Gift-wrap available.


Amazon Price New from Used from
Kindle Edition 34.09  
Hardcover 35.88  
Paperback 42.32  
Trade In this Item for up to 10.22
Trade in Python Scripting for Computational Science (Texts in Computational Science and Engineering) for an Amazon Gift Card of up to 10.22, which you can then spend on millions of items across the site. Trade-in values may vary (terms apply). Learn more
There is a newer edition of this item:
Python Scripting for Computational Science (Texts in Computational Science and Engineering) Python Scripting for Computational Science (Texts in Computational Science and Engineering)
Available for pre-order

Book Description

9 Jan 2009 3540739157 978-3540739159 3rd ed. 2008. Corr. 2nd printing 2009

With a primary focus on examples and applications of relevance to computational scientists, this brilliantly useful book shows computational scientists how to develop tailored, flexible, and human-efficient working environments built from small scripts written in the easy-to-learn, high-level Python language. All the tools and examples in this book are open source codes. This third edition features lots of new material. It is also released after a comprehensive reorganization of the text. The author has inserted improved examples and tools and updated information, as well as correcting any errors that crept in to the first imprint.

Frequently Bought Together

Python Scripting for Computational Science (Texts in Computational Science and Engineering) + Ben Graham Was a Quant: Raising the IQ of the Intelligent Investor (Wiley Finance) + Beat the Dealer (Vintage)
Price For All Three: 71.99

Some of these items are dispatched sooner than the others.

Buy the selected items together

Product details

More About the Author

Discover books, learn about writers, and more.

Product Description


From the reviews of the second edition:

"This book addresses primarily a CSE (computational science and engineering) audience. … gives a clear and detailed account on the ways in which the surprisingly powerful Python language may aid the CSE community." (H. Muthsam, Monatshefte für Mathematik, Vol. 151 (4), 2007)

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

There are no customer reviews yet on
5 star
4 star
3 star
2 star
1 star
Most Helpful Customer Reviews on (beta) 4.5 out of 5 stars  11 reviews
165 of 170 people found the following review helpful
5.0 out of 5 stars Convincing demonstration of Python's value in science 15 Oct 2004
By C. Dunn - Published on
The author has 2 main goals:

1) To improve the productivity of scientists familiar with specific software systems (especially Matlab, Maple, and Mathematica) by teaching them to "glue" applications together.

2) To advocate Python as the preferred "glue" language. In his own words, "I hope to convince computational scientists having experience with Perl that Python is a preferable alternative, especially for large long-term projects."

He has certainly done a creditable job. As an expert in computational differential equations, he neglects neither efficiency nor correctness, while stressing both simplicity and reliability. In this sense, he has done a great service to the Python community.

The question is: What justifies the purchase of his book?

The answer is: Chapters 4, 9, and 10.


1. Introduction--26pp

Very convincing arguments.

2. Getting Started With Python Scripting--38pp

Interesting examples.

3. Basic Python--56pp

A too-quick tutorial. Go to python dot org instead.

4. Numerical Computing in Python--48pp

Stellar explanations of vectorized array operations.

5. Combining Python with Fortran, C, and C++--36pp

Details use of Fortran2Py and SWIG. Mentions many alternatives.

6. Introduction to GUI Programming--70pp

Useful examples of Tkinter/pmw widgets.

7. Web Interfaces and CGI Programming--24pp

Good source of ideas.

8. Advanced Python--132pp

Deep and extensive. Includes: option parsing, regular expressions, data persistence and compression, object-oriented programming, exceptions, generic programming, efficiency.

9. Fortran Programming with NumPy Arrays--32pp

All about efficiency and re-use.

10. C and C++ Programming with NumPy Arrays--40pp

More about efficiency. NumPy C API, C++ objects, and SCXX.

11. More Advanced GUI Programming--73pp

Tedious discussion of both Web and standalone GUIs. BLT, canvas, cgi.

12. Tools and Examples--70pp

Excellent examples of PDE solvers, with a powerful GUI, but quite long and tedious.

A. Setting up the Required Software Environment--16pp

Wonderfully specific installation instructions!

B. Elements of Software Engineering--50pp

Python's strength! Very practical advice on modularity, documentation, coding style, regression-testing, version-control.


+ Downloadable py4cs package, esp. numpytools module

+ Great advice everywhere, e.g. CGI checklist, Pythonic programming, and trouble-shooting.

+ Concrete evidence for most assertions.

+ Very attractive presentation. Sturdy, high-quality cover, binding and pages. Brief, elegant code fragments (except in Chapter 12). Readable prose. No wasted space.

+ Available as 5MB pdf file, after purchase of hardcopy. Very nice.

+ Slides, installation instructions, and errata also at web site. Very professional.

My peeves:

- Not enough tables to be a useful manual.

- On p.428(#7) he points out that handling a raised exception is very slow. However, when I time his example with a positive argument, the try-except version is 20% faster (b/c the if clause is skipped), so he is actually giving bad advice for the general case. Luckily, he contradicts himself later, on page 685: "Exceptions should be used instead of if-else tests." The best advice: Avoid common exceptions in inner loops.

- The 10-page index is not as great as it at first seems. (See Martelli's Python in a Nutshell for a better one.)

- Pure interface functions should 'raise NotImplementedError', rather than 'return'.

- Exceptions should never be trapped mindlessly with 'except:'. That would hide your own SyntaxErrors!

- Too many exercises. (It's published as a textbook.) Since there are no answers, the exercises are useless for non-students. (See Lutz's Learning Python for effective exercises with answers.)

Overall rating:

This contains the best information on numerical programming in Python that I've seen. Though expensive, it could easily be your only Python book, given the excellent online documenation already available.
12 of 12 people found the following review helpful
5.0 out of 5 stars *The* reference for folks who work with Matlab 26 July 2009
By G. Jaouen - Published on
I'm giving this book five stars because it was basically written for me. I don't mean that literally, of course. I say that because the usual methods of googling for answers and reading the manual do not work when you are trying to push the limits of what a tool is capable of doing. I do numerical computations for a variety of things -- finding patterns in large data sets, automating data collection and analysis, converting raw serial output into convenient CSV, plotting multidimensional datasets etc. Over the years, I have collected a large number of productivity habits with Matlab, which allows me to do ridiculously convoluted things in a short period of time. You just have to read the introduction of any Python manual to understand why I am switching from Matlab to Python. The problem is -- what will replace all these productivity habits? They need to be replaced with "Pythonic" habits, something that can take years of practice.

The beauty about Langtangen's book is that it runs through every one of those techniques. Instead of giving a basic example (what your google search would have provided) or a complete list of, ahem, useless techniques (what the manual would have provided), you get exactly what a seasoned data analyst needs to know to get moving with state-of-the-art commands. The author also discusses optimizations and alternatives in each chapter.

The book is also the best source for explaining *why* NumPy should be used by people working with large datasets. Folks love to create toolkits for Python, but some of these are a list of non-intuitive shortcuts that don't provide a substantial improvement over basic Python. Langtangen goes through the pain of explaining the benefits of the package (chapter 4.1.4), so that you can decide for yourself if NumPy is useful for your application.

I will not comment on the parts of the book that deal with C and FORTRAN integration because I leave that to more able programmers. I also will not comment on the extensive GUI building chapters because I do not build GUIs. I will point out, though, that I have derived full value out of this book simply by reading, and re-reading chapters 2, 3, 4 and 8. Some will argue that there is too much "basic Python" in these chapters for the whole to be considered advanced computational science -- my opinion is that even when the author describes "basic Python", his examples and intuition make it so that even one who has read a couple of reference books cover-to-cover will learn something about using "basic Python" to perform numerical analysis in a more efficient way. In fact, the book is a testament to doing really convoluted things in a really compact and elegant manner!
59 of 77 people found the following review helpful
3.0 out of 5 stars Python for Science Academics and Engineers, NOT programmers 3 Jun 2005
By Braddock Gaskill - Published on
Format:Hardcover|Verified Purchase
I bought this book as an experienced programmer and Unix user expecting more of a "Numerical Recepies in Python" emphasis on the efficient implementation of algorithms which happen to be in Python. I should have paid more attention to the description.

This book is really more of a "Grad Student's Guide to Everyday Python Usage". I imagine it would be very valuable to a mathematics Grad student without too much programming or shell experience, looking for an alternative to Matlab. However, there is very little "Computational Science" in this book. Do NOT expect a cookbook of high performance algorithm implementations.

The book is a very verbose 700+ pages, all in an unexciting academic LaTeX format. The author works through idiom after idiom for accomplishing different tasks in fairly stand-alone sub-sections without much of a feeling of conceptual "flow" between them. It sort of feels like reading through the author's personal lab notes that he took everytime he learned a new language feature or trick.

If you are an experienced programmer, you will quickly get impatient with the verbose presentation that emphasizes idioms and examples instead of fundamental concepts and syntax reference tables. But, if you are an experienced programmer, you are not the target audience for this book.

Braddock Gaskill
7 of 8 people found the following review helpful
5.0 out of 5 stars Great Suppliment to Numerical methods 25 July 2006
By Andy R. Terrel - Published on
When I first got ahold of this book I had just finished learning all the gory details of good numerical codes. But when developing tests for simple cases I found that development went way too slow, so someone suggested I learn Python. This book provides a great demonstration of how python can supplement your existing codes. Either by organizing the tests, formatting output, or just adding pretty interfaces.

This book contains a lot of the necessary extras that a scientist or engineer must do to get his work going or finished, which is too pedantic to be taught in most courses. It shows the power of Python over some other scripting languages for this purpose. It is definitely one of the best references on my book shelf.
4 of 4 people found the following review helpful
5.0 out of 5 stars Outstanding introduction to Python and Numpy 15 May 2010
By Rich - Published on
I've bought what seems to (my wife) be every Python book out there and I can't tell you how sick I am of spam, spam, spam code! (trivial and obfuscated Python code examples with a common theme focused around one Monty Python skit or another...) Spam code seems to prevail in other Python books.

Here finally is a book with code examples that are very clear, are immediately useful to the serious programmer and filled with real life discourse on relative performance differences between Python and other languages that have a reputation for speed. There are clear examples of 'number crunching', producing images and even video animations, hooks into other scientific packages such as MathLab, etc.

If you are interested in really learning Python, want to come away from an hour or twos worth of coding experience with a module or two that you can use tomorrow and are not interested in code examples extolling Monty Python silliness, then this is the book for you.

While this book is about twice as expensive as many of my other Python books, I wish I had purchased this one first. Even though I've been using Python, seemingly every day, for two years, I kept finding nuggets in this book with what seemed to be every turn of the page. My focus right now is processing extremely large data sets of binary data but I'll soon be looking at image processing and I know I'll be reaching for this book over and over again. Don't hesitate! Just buy the book!
Were these reviews helpful?   Let us know

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
First post:
Prompts for sign-in

Search Customer Discussions
Search all Amazon discussions

Look for similar items by category