Reputation: 13062
i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available.
i have done some research and many have said that python is a worthy replacement for matlab in various scenarios. i want to know how to do all this with python. i am using a mac so how do i install the different python packages. what are those packages? is it really a viable alternative? what are the things i can and cannot do using this python setup?
Upvotes: 17
Views: 18493
Reputation: 10967
On a Mac the easiest ways to get started are (in no particular order):
sudo port install py26-numpy py26-scipy py26-matplotlib py26-ipython
should get you started.I've done exactly this (replace Matlab with Python) about 2 years ago and haven't looked back. The broadcasting in Python, more intuitive memory model and other Numpy advantages make numerical work a complete pleasure. Plus with f2py, cython it is incredibly easy to put inner loops in another language. This is a good place to start - other impressive pages to provide motiviation are PerformancePython and ParallelProgramming. Be sure to understand Pythons "variable is a reference to an object" semantics... after that adjustment everything is plain sailing. One of the coolest things that beats matlab is in 2 lines I run over 8 cores... p = Pool(8); res = p.map(analysis_function,list_of_data)
- MATLAB parallels toolboxes are so expensive I've yet to see a University that actually has them.
Upvotes: 21
Reputation: 98
There are three aspects to consider when replacing Matlab with Python; the core language capabilities, the IDE and the Price.
This section outlines all of the capabilities of each platform. In short everything Matlab can do, Python can also do plus much more. However, things like linear algebra and rapid prototyping Matlab does more cleanly.
Everything in Matlab is ready bundled and toolboxes are seamlessly integrated. It is also much more mature - but was not designed for general purpose programming meaning anything not linear algebra related is painful to implement.
Python will require a number of additional modules for it to become a good Matlabreplacement.
repmat
rubbish.This is where python is lacking in my opinion. I simply find algorithm development (particularly involving a lot of linear algebra) less painful in the Matlab IDE.
Here are some key Matlab features which will be hard to live without as an engineering student. Note that Python IDEs do have some of these capabilities also, but are more sloppily implemented.
There are some new python IDEs which are starting to compete with some of MATLAB's key advantages. I personally like PyCharm which was recently released as a free community version. It has the following capabilities and is very well designed from a UI perspective.
Python is free and has an active support community. Matlab also had a good support community too, but is anything but free.
Upvotes: 6
Reputation: 3200
It would be great if the matlab to python conversion mat2py project at sourcefourge took off..
Upvotes: 0
Reputation: 2981
I've been programming with Matlab for about 15 years, and with Python for about 10. It usually breaks down this way:
If you can satisfy the following conditions: 1. You primarily use matrices and matrix operations 2. You have the money for a Matlab license 3. You work on a platform that mathworks supports
Then, by all means, use Matlab. Otherwise, if you have data structures other than matrices, want an open-source option that allows you to deliver solutions without worrying about licenses, and need to build on platforms that mathworks does not support; then, go with Python.
The matlab language is clunky, but the user interface is slick. The Python language is very nice -- with iterators, generators, and functional programming tools that matlab lacks; however, you will have to pick and choose to put together a nice slick interface if you don't like (or can't use) SAGE.
I hope that helps.
Upvotes: 13
Reputation: 26552
Try Sage - it is designed as an open source replacement for Matlab, Mathematica etc. It is implemented in Python and can be scripted with Python, but it also adds a lot of maths-specific features. There is an installer for the Mac, so you will not need to download lots of individual packages.
There is also GNU Octave - another open source alternative to Mathematica/Matab that has its own programming language. However I have not found any information on a Mac version (though I have not looked very hard).
Upvotes: 4
Reputation: 188064
Maybe you like sagemath, which 'combines the power of many existing open-source packages into a common Python-based interface'. Here is a feature tour.
Upvotes: 4
Reputation: 11569
python(x,y) is quite powerful, but only for Windows or Linux so you'll have to use bootcamp or Linux. A more lightweight package for mathematics is Matplotlib, which basically adds plotting abilities to the Python language (better used together with IPython).
Upvotes: 1
Reputation: 6906
Duplicate of this.
My sense is that for pure numerical/linear algebra computations and visualization Matlab is a slightly more consistent development environment. Numpy/Scipy/Matplotlib feel, to me, a bit haphazard. If you are building a full program -- to automate a system or display results on a webpage -- Python the advantage of being a real programming language first and foremost. But for interactive numerical processing I think Matlab still wins. The lack of element wise infix operators in Python is one small example (PEP 225). For statistical computing, data exploration and visualization, it is hard to beat R.
Upvotes: 0