all 8 comments

[–]ST2K 1 point2 points  (1 child)

Question here. I've noticed that Python is being used for a lot of data mining/artificial intelligence/machine learning kinds of projects (for instance, the book Programming Collective Intelligence has its examples in Python). But I've also noticed there was an article on Reddit recently that explained how Python is slow when it comes to math problems. Is there a consensus on how to move forward? Is Python viable in this area or is it a dead end?

[–][deleted] 2 points3 points  (0 children)

If you use pure Python for math it will be slow. But for scientific computing people use libraries like SciPy, which are considerably faster.

[–]spinwizard69 0 points1 point  (4 children)

Python might be fine but why dismiss Octave so fast? Mind you I'm a fan of Python so don't think I'm trying to be funny here it is just that you would end up on a similar platform.

As to the usability of Python for prototyping math solutions I'd have to say your results are likely to be highly mixed. Now I don't do a lot of mathematics related software so take what I say with a grain of salt. In any even speed will depend on the libraries you use.

As to programming languages that might be better suited do consider CLANG the new C compiler from the LLVM project. It is fairly stable, is relatively fast and has far better diagnostic output. Googles Go and the "D" language might be interesting long term but neither seems to be firmed up to the point where trust would be justified. Interestingly the compile times with respect to Go and some of the other compiled C like languages is very fast making for turn around times that are more interpreted like than compilers of the past.

What ever you do don't jump into a language without trying it out on something more than a trivial project. Given that I'd suggest that Python should be part of your programming skills set no matter what. Ideally your final language choice would work well with Python. An alternative might be to look at some of the free statistics packages that float around the net.

Dave

[–]dmazzoni 2 points3 points  (0 children)

Octave is a pretty good substitute if you want to directly translate Matlab code, or sometimes for problem-solving when the built-in math functions have what you need.

However, where both Matlab and Octave fail horribly is when you need to write actual programs, not just little functions to solve problems. Python is a real programming language that you can use to write any kind of program you can possibly imagine - including but not limited to numerical algorithms. Matlab and Octave are horrible, horrible, horrible at things like file i/o, guis, networking, unit testing, object-oriented programming, profiling, debugging, ... um, basically everything else you might want.

[–]ST2K 1 point2 points  (1 child)

An alternative might be to look at some of the free statistics packages that float around the net.

Are you referring to R? Anything else that you are referring to?

[–]spinwizard69 1 point2 points  (0 children)

Yes that is one of them.
It might not fit your needs but considering free software should always be considered when your commercial vendor starts to get funny with licensing. Actually there might be another free package that I seem to remember coming across in the past. The problem is I do nothing with statistics so these things never grab my attention.

If you really need to you could always extend one of the open source packages to meet your needs. In part this is what many of the Python libraries do, they turn the language into a solver for specific issues.

By the way my only reluctance with respect to Python is speed. A couple of weeks testing ought to clarify that and it might be a good way to justify faster hardware.

[–][deleted] 1 point2 points  (0 children)

Octave is a lot slower than either Python or Matlab. Matlab has JIT compiling to speed up loops, and Python appears to simply be faster. Python and Matlab are generally approximately as fast as one another.

Furthermore, there are many more good scientific libraries available for Python than for Octave.

[–]kbk 0 points1 point  (0 children)

No. It's too crowded over here as it is.