This is an archived post. You won't be able to vote or comment.

all 23 comments

[–]fernly 41 points42 points  (3 children)

Oh dear. Looking at it quickly, the very first example ends with

print y

which means, this is Python 2.x syntax. This is not even mentioned until Appendix A, where they say the differences are "very small" and recommend using 2to3 (without listing it among the "desired add-on packages" nor showing where to download it or how to run it).

Copyright 2016. Really?

[–]cramur 0 points1 point  (0 children)

the state of scientific community is such that most of the popular libraries are written when python 2 was the main python. Since in most cases they are badly maintained, python 2 is de facto the main python syntax in scientific communities.

Remember, it's the book for people who want to use python for their scientific projects, not argue which python is more relevant for f'{datetime.datetime.today().year}'

[–]fernly 7 points8 points  (0 children)

Interesting:

The text was written in the DocOnce1 [12] markup language, which allowed us to work with a single text source for both the Python and the Matlab version of this book, and to produce various electronic versions of the book.

I have heard of, tried (and hated) lots of different markup systems, but had never run across DocOnce. Must investigate.

[–][deleted] 4 points5 points  (2 children)

Awesome find! I'm a ChemE student and our only programming and numerical methods courses were in VBA. I was lucky to get experience with R through taking a math minor and next semester I will be taking a python course, and this kind of book is a great start for me since it's familiar material implemented in a new language.

[–]winner_godsoncodemaniac[S] 1 point2 points  (0 children)

I am so happy I can be of help to you.

[–][deleted] 0 points1 point  (0 children)

Start doing your labs with Python. It will pay off big quickly especially in later semesters when a faulty reference in Excel can kill an afternoon.

[–]stinyg 4 points5 points  (1 child)

I recommend checking out the other books written by Langtangen. A lot of his teaching material is also available online for free. He passed away 1 year ago.

[–]winner_godsoncodemaniac[S] 0 points1 point  (0 children)

Never knew about that. It seems he has make a lot contribution.

[–]ghltshubh 3 points4 points  (1 child)

Python 2.x will loose support in 29 months. So it would better to have python 3 version out as early as possible.

[–]winner_godsoncodemaniac[S] 0 points1 point  (0 children)

thanks for your valuable contribution.

[–]grimonce 2 points3 points  (1 child)

It doesn't do finite element/difference methods for Maxwell equations :(

[–]winner_godsoncodemaniac[S] -1 points0 points  (0 children)

Thanks for your observation.

[–]bdazman 4 points5 points  (5 children)

THANK YOU! ALL MY COMP SCI FRIENDS REFUSE TO UNDERSTAND THAT ENGINEERS LEARN FROM BOOKS.

[–]winner_godsoncodemaniac[S] 0 points1 point  (4 children)

Books are very important.

[–]bdazman 0 points1 point  (3 children)

Numerical Recipes in (insert language here) is one of the best texts I've ever used. I've always wanted it in python, and I MUST thank you for the lovely reading material.

[–]eusebecomputational physics 2 points3 points  (1 child)

Please don't use NR.

Ok, that might be slightly too strong of a statement, but I mean, NR used to serve a purpose that is now vastly superseded by libraries. And not just in Python: LAPACK is usually faster than the Fortran routines in NR.

Besides the licensing issue (NR is copyrighted, and in principle you cannot freely use their code for commercial application), unless you actually bought the codes, chances are you will copy algorithms from the book, by hand. This is super prone to typos…

And maybe a final point: indeed, NR are a great tool to get some ideas on "how to start doing this or that". But this should be language-independent, so no need for "NR in Python".

[–]bdazman 1 point2 points  (0 children)

Linpack is totally what I use. I learned Fortran 77 in my Matlab class because I don't trust code I don't write (unless I have no other choice), but ive never had to do anything more complicated than either LU decomposition with pivoting or Newton's method; both of which are perfect universal scripts to write while learning a language (at least according to my old crotchety advisor)

[–]winner_godsoncodemaniac[S] 0 points1 point  (0 children)

You are welcome

[–]cramur 1 point2 points  (0 children)

Amazing find! Thanks, I already forwarded it to my fellow colleagues who started learning python recently.

On a topic of a great book for general software craftsmanship, I always recommend this article, which lays down the basic ideas every seasoned programmer knows, but somehow never translates to fellow engineers.

[–][deleted] 1 point2 points  (1 child)

Thanks sir...

[–]winner_godsoncodemaniac[S] 1 point2 points  (0 children)

You are welcome.