Has anybody else out there made this switch? I'm considering it right now. What were the negatives and positives of the switch?
-
31/ why do you want to do this switch? 2/Have you tried R ? – RockScience Mar 07 '11 at 02:09
-
@fRed: 1) open source, better oop, seems like a lot of people are moving to it. 2) I used R before Matlab and dislike its development environment. – Rich C Mar 07 '11 at 02:25
-
7If you disliked the R gui on Windows, consider the free, brand-new, cross-platform RStudio GUI. – Dirk Eddelbuettel Mar 07 '11 at 02:54
-
1or R with Eclipse using the Statet plugin. – RockScience Mar 07 '11 at 03:47
-
3Strange, I've never heard/read of anyone switching from Matlab to Python and hating it. People usually have glowing things to say about py. I will have to give it a try. Thanks for your input. – Rich C Mar 08 '11 at 18:49
-
1And let's not forget hooking up Python with R via rpy2 is quite straightforward if you need to access R libraries. – Kenny Shen Mar 08 '11 at 22:30
-
1I was once told in a graduate Finance class "you can't use python for finance it doesn't have the plugin's", i don't think he know's what he was talking about – pyCthon Aug 29 '12 at 02:11
-
While I strongly dislike R's syntax and Python gives this pragmatic feeling of "I can get things done [quickly]", Python really lacks R's statistics tools. Python has a mid-size basis of statistics tools, but you need to call R for pretty basic stuff like seasonality/trend-decomposition, not to speak of more advanced statistics, but it partly compares with Matlab, I think. I believe something like the Rmetrics package isn't given anywhere outside of commercial tools yet, so that is definately something Python is lacking currently. – Konsta Oct 09 '12 at 20:25
7 Answers
I made the switch years ago, and it has been great. I even switched the class I teach from Matlab to Python. Here are some things to consider
- Others can run your Python code when you share it with them. Matlab has compilers and the like, but they are an extra step you must take since most people do not have Matlab on their desk.
- Python and its extensions are open source and so allow you to see under the hood
- Python ctypes is slightly nicer than Matlab C integration
- Python syntax is excellent (e.g list comprehensions), and NumPy syntax for arrays is also cleaner than Matlab's
- Python is easier to integrate with external data sources and files
On the other hand
- Matlab integrates nicely with Java
- Matlab optimization routines are really excellent
- Matlab 3D plotting is better
- 14,842
- 28
- 59
-
Don't forget that the integrated 'solvers' for nonlinear problems is an important aspect as well. This could have serious consequences for complex optimizations. For instance, GAUSS already outperforms Matlab in the sense that you will find less local minima. – JohnAndrews Apr 13 '12 at 00:56
-
I would just add few points on the matlab side: (1) if you buy the compiling toolkit, then you can redistribute your code everywhere without paying more license fees. (2) matlab statistical tools are very good and properly coded. – lehalle Aug 30 '12 at 13:13
-
Let's not forget the most important point .. python can be used in an object oriented fashion. – user2763361 Oct 02 '13 at 13:56
-
I believe your 3rd point in favor of Matlab is no longer valid, as there is an amazing Mayavi package for Python which is very easy to use and quite impressive. – sashkello Jan 13 '14 at 04:01
-
@lehalle 1. If you are collaborating with others, that doesn't help. Also you need to buy it. It is certainly not a point in favor of Matlab. 2. The fact that those tools are not free doesn't make them more "properly coded" than python's. Python also has very good and properly coded statistical tools, and while Matlab has things which Python doesn't, so Python does have things which Matlab doesn't have. – sashkello Jan 13 '14 at 04:07
-
@sashkello about (2): my opinion is a statistical toolbox is at least more "transparent" on not free tools (sorry), just look at matlab (and think about mathematica) help files, it is obvious: you have references, formula, etc. Usually for open source software if you are lucky you have the ref of just one paper (the one which procedure is implemented); plus a huge pdf file (but only if the implementation has been done during a thesis or a post doc) not going to the essential... – lehalle Jan 13 '14 at 07:08
-
@lehalle Yes, on that point you are right, documentation for Python is often poor (not always the case), while Matlab's is mostly very good. It makes things more "transparent" in terms of usage, but not in terms of what happens under the hood. My comment was referring to optimality of the algorithms. While I do believe that Matlab's programmers try hard to make everything squeaky clean, it doesn't really mean that it is that way. For Matlab, you have no way of finding out what's happening behind the scenes, in Python you can find out, improve, build your own tools on top etc. – sashkello Jan 13 '14 at 08:59
-
@Brian_B Maybe should be added to answer - Matlab's docs are better. – sashkello Jan 13 '14 at 09:00
Rich, you might find this cheatsheet useful on your journey.
I was advocating Python over Matlab to a co-worker just minutes ago. I should start by saying that Matlab is a fine piece of software - its documentation is amazing, as are the pdfs that accompany the various toolboxes (as I'm sure you know).
However, regarding Python, Brian B brings up many good points. Two big advantages I would like to emphasize:
I know that I will be able to develop Python anywhere I might work in the future (including at home over the weekends). In other words, learning the language is time well spent. Learn once, and benefit for years. It's the same reason why I love working on the command line in *nix environments, instead of GUIs (MS Office ribbons come to mind).
I acknowledge that a very large portion of quant research is simple, unglamorous data manipulations - Python serves as a strong glue language (like Perl, but with much stronger numerical libraries). I can set cron jobs for Python scripts that load data, send me emails, etc. I'm sure there are those who do this in Matlab (just like there are those that do all sorts of crazy stuff in VBA), but Python is a far better tool for these jobs.
Having said all of that, all legit quant shops can afford Matlab (and all of the costly toolboxes required for database access, xls read/write, compilation - which really should be free IMO). If you are purely research, then you can probably get by with only Matlab, but I find it somewhat restrictive and, perhaps, somewhat risky in terms of availability.
- 1,154
- 7
- 11
-
How java compares with py? Any experience? Actually why py and not java? – user40 Mar 08 '11 at 12:59
-
Py - interpreted, flexible, simple. Java - compiled, strict, bloated. Java's a nice language for building a big complicated system with many developers working on it, but crummy for rapid prototyping of an idea. I also think SciPy is better than any Java numerical lib I've used. – evanrsparks Mar 08 '11 at 13:04
-
Java for numerical analysis / quantitative research is pretty much a horrorshow. You'll find yourself writing 10x as many lines. The bugs may not quite scale with that but it's safe to say you will see maybe 2x the bugs. – Brian B Mar 08 '11 at 13:44
-
Fair enough! That's exactly my problem with java... I need to look at py soon.... – user40 Mar 08 '11 at 14:55
There is a Python library for this that you may want to take a look at: http://gbeced.github.com/pyalgotrade/
- 31
- 1
I've only found MatLab to be useful for modeling and testing algorithms, with the implementation in any other language.
- 472
- 1
- 6
- 15
I'm a big fan of python over the competitors as well. I use the pysci & matplotlib libraries heavily which are all open source albeit not specifically designed for optimizations but solid for visualizations & fast analysis.
Another part of making a transition for me, was the ease of use on the Mac. It's native although I do use macports (very easy install) for several other projects & it augments my development environment nicely. Macports provides a huge catalogue of modules easily installed with 1 command & dependency resolution (no *nix package mgmt. hell) & of course all of the IDE's work nicely (I use VIM). Git is native, debugging is very mature, & if you can get over strict indentation (macros or IDE's help) then it's typically quite readable code.
Never posted before but have lurked for months so hopefully this contribution helps.
- 11
- 1
MATLAB has a trading and backtesting toolbox which offers similar functionality to other retail trading packages. http://www.tadeveloper.com
- 9
- 1
-
3You should point out that you are affiliated with TA Developer. Additionally, The Mathworks appears to have no affiliation with you; this is a software package that happens to be written in MATLAB. – chrisaycock Dec 29 '12 at 20:52
-
@chrisaycock Yes, you are right. Reading my post again it sounds like the toolbox is offered by the Mathworks. This is not the case. – Joern Dec 29 '12 at 22:19
Everything has pros & cons. So it has to do with personal preferences but more importantly to me it has to do with what your shop uses. Most use a mix of interpreted/compiled language.
- 230
- 1
- 2