7 ms·
Python in the Scientific World
- garnet7 17y agoMy guess is that scientific computation is a lot of fun. Plenty of clean mathematics. Probably not too much dingy boiler room stuff. I can see how one would be attracted to using languages like Python (and maybe Scheme too) for such tasks.
- scott_s 17y agoThere is lots and lots of "dingy boiler room stuff" in scientific computing. What the math is doing is clean. Doing that as efficiently as possible in a computer is generally not.
- easp 17y agoAnd there is all the data handling/mangling that needs to be done.
- whye 17y agoOn a computer, you have to also be concerned about error propagation and efficiency, and that can take what might be a very beautiful, simple solution on paper and explode it into a big ugly mess in code. That doesn't mean it isn't fun, but it's a lot less clean than you might think.
- bravura 17y agoIn NLP there is a large amount of boilerplate and perprocessing code. The barrier to entry is actually quite high. New machine learning model for machine translation? "Sorry I'm not convinced your model would work with a sophisticated multitext grammar using available translation lexicons etc etc". Building a convincing baseline is hard. Which means that it is difficult to show your approach works in general
- jlees 17y agoThe Python NLTK helps a fair bit with some of that, especially at an introductory level. Of course, I hand-wrote a lot of my NLP algorithms in Perl, back in the day. Now that's a good use of a time machine...
- the_real_r2d2 17y agoFor beginners there is also an on-line book: http://www.nltk.org/book http://www.nltk.org/book
- jlees 17y agoAs well as a printed version, published by O'Reilly, for those of you who prefer dead trees to pixels (like me).
- adw 17y agoOh man. Nonono. It's huge amounts of glue and connect-this-program-to-that-program-with-a-pile of regexes. Most of the number-crunching's in hand-optimized C or F90... During my PhD, I designed/wrote a transition-state prediction algorithm in Python, hooking it up to atomistics codes written in Fortran. One of my colleagues, now one of my cofounders at Timetric, wrote a standards-compliant XML library in ANSI F95 - http://uszla.me.uk/FoX/ http://uszla.me.uk/FoX/ - which, believe it or not, is one of the rare cases where XML made life a lot better!
- elblanco 17y agoIt's really amazing to see how something is finally starting to supplant ancient Fortran code in sci-comp. I think one of the major reasons for Python being that choice is that its syntax and "Python way of doing things" is really geared at making it difficult to obfuscate the code into meaninglessness. Clarity is always important in research.
- Avshalom 17y agosorta kinda, but not really, python isn't supplanting fortran, it's supplanting Matlab/IDL for prototyping and visualization, and half-baked command languages for interfacing with packages of data reduction routines. Which is still nice, especially things like (to take astronomy) AIPS/IRAF, specialized packages of routines that are controlled by the worst command language possible.
- ajdecon 17y agoAlso note that the code at the core of packages like numpy is often still written in Fortran or C. For example, I'm pretty sure all the linear algebra processing in numpy is handled by the popular LAPACK written in Fortran. Note that software like Matlab and IDL also generally uses these well-understood packages. Fortran isn't going anywhere, we're just hiding it in the background.
- gaius 17y agoEveryone uses LAPACK. If you came along with your own versions of those routines, no-one would would trust them. LAPACK et al are the most optimized, most debugged code on the planet. Hardware vendors design around LAPACK. It's incredibly important. Also check out Sage: http://www.sagemath.org/ http://www.sagemath.org/
- adw 17y agoYep. The Intel F9x compiler smokes everything - at least in part because its versions of LAPACK/BLAS/ATLAS are so aggressively optimized.
- SandB0x 17y agoI would be incredibly happy if we were taught in Python or anything other than the hideous monster that is Matlab on my MSc course. After using Ruby and Python it's rather painful to use such a clunky environment.
- buugs 17y agoI am curious as to why you would hate matlab so much other than the clunkyness. EDIT: And of course cost/openness Matlab works very well for many disciplines and the shear amount of documentation make it very easy to use for people who aren't really programmers. My main peeve with matlab is that to write a function it is required to make a separate file however most problems that are solved with matlab don't really need functions in the first place. SciPy/NumPy and matplotlib can be nice to use but if I need to get an engineering problem done quickly I can find functions that I need much quicker in matlab and the matrix as the central object is very helpful.
- SandB0x 17y agoYes, the closed system is a big thing. Anything interesting I may create will have to be re-written in another language if I want to extend/share with others. While it's not reasonable to use something like c to test out (computer vision in this case) algorithms in practical classes, Python is both simple and open. The problem of having many possible combinations as mentioned by lliiffee doesn't seem like much of a big deal. Surely a faculty could just specify their recommended setup?
- lliiffee 17y agoSure, you can specify it. Specifying is no problem!
- joeyo 17y ago> My main peeve with matlab is that to write a function it > is required to make a separate file however most problems > that are solved with matlab don't really need functions > in the first place. That's just where the madness begins! My current pet peeve is that you can't index the result of a function directly: x = 10:-1:1; a = sort(x)(1:5); % illegal! tmp = sort(x); % depressing :( a = tmp(1:5); f = @(x,i)x(i); % a little better a = f(sort(x),1:5); Every release gets a bit better, but there are still a lot of strange historical limitations.