Slashdot Mirror


Mathematica vs. Matlab?

Ninnux asks: "I wanted to find out from the community which was the better mathametics modeling package: Mathematica or Matlab. The cancer center I research and program for is considering purchasing a license set. I'll be working with Bayesian machine learning and other bioinformatic approaches for hormone pathway modeling. I know Matlab has various toolboxes that would be rather useful, but I'd like to hear what people think." While I'm sure direct comparisons will be made, I think focusing on the specific niche will help Ninnux the most; so, how well does each piece of software handle Bayesian functions and other bioinformatic computations?

37 comments

  1. Mathematic and Maple vs. Matlab by jbolden · · Score: 5, Informative

    Mathematica and Matlab are very different products. Mathematica focuses on quality symbolic computation and features like unlimited precision arithmetic. Matlab focuses on high speed algorithms for numerical computation.
    Maple is a similar product to mathematica.

    So really the question is would you rather have faster numerical processing or greater symbolic capacity?

    1. Re:Mathematic and Maple vs. Matlab by grammar+nazi · · Score: 3, Interesting
      jbolden pretty much sums up the differences in the parent comment.

      I used mathematica extensively in college, and I've used Matlab + neural network toolbox extensively in my profession.

      Another majore difference between the two is programming languages. Mathematica is best utilized as a functional, lisp-ish programming language, while Matlab is best for C-ish programming that is optimmized for vectors. If the whitepapers that you read for your research do a lot of AI programming in Lisp, then go with Mathematica. If the AI whitepapers use a lot of neural networks or general C/Fortran algorithms, then go with Matlab.
      If you are using the math package for prototyping, and then converting the code a run-time system, then I would definitely stick with Matlab->C and Mathematica->Lisp.

      Ninnux, if you are serious about this, then email me at b_pretender(at)yahoo(dot)com and I can tell you a little more about what I've used and what I've thought about it. We developed our own baysian filters and also used the Matlab image processing toolbox extensively. Most of my comments will be Matlab biased, but that is because I've used it and I've liked it.

      --

      Keeping /. free of grammatical errors for ~5 years.
    2. Re:Mathematic and Maple vs. Matlab by jayteedee · · Score: 1

      Another fine tidbit is that Matlab is far easier to learn and REMEMBER. I've used both Matlab and Mathematica extensively and I always have to go back to the book after I leave Mathematica for a month or two. The syntax is a killer. Matlab has some of that (just like C, C++), but it is definately easier to pick back up. There is also a significantly better presence on the internet with Matlab over Mathematica or Maple. If you have to do symbolic computations then Mathematica and Maple are the only solutions, but for math, vectors, matrices, ease-of-use, and other math problems for which there is a toolbox (library) available, then Matlab wins hands down.

      --
      Religion and science are both 90% crap..but that doesn't negate the other 10%.
    3. Re:Mathematic and Maple vs. Matlab by cougartoo · · Score: 1
      I concur with your re-focused question.

      However, it's worth pointing out that Matlab has add-on packages for symbolic manipulation (although the end result is not even close to Mathematica's capabilities) and Mathematica has perfectly fine numerical capabilities (although, not nearly as performance-oriented; generally, one is more removed from data in Mathematica than in Matlab).


      My guess is: you'll be doing lots and lots and lots of simulations---same code, small tweaks, thousands of iterations. That spells Matlab in my book.

    4. Re:Mathematic and Maple vs. Matlab by Anonymous Coward · · Score: 0

      Didn't you mean b_pretender@yahoo.com?

  2. Well.... by ByronEllis · · Score: 3, Informative

    Matlab is probably more useful to you than Mathematica since you'll be working with simulations and/or data it sounds like. You might also want to check out R, which is designed as a statistical analysis environment and has a large number of packages---including machine learning and whatnot. Its also Open Source and GPL if you care about that sort of thing and runs on pretty much any platform you could potentially care about.

    1. Re:Well.... by cougartoo · · Score: 1
      I think I agree with you, for the same reasons: numerical simulation and data processing. Matlab excels in both, although Mathematica can certainly do them.


      I also second the suggestion to investigate R. It is vigorously supported by the statistics community, and has numerous add-on packages. A slightly steep learning curve (steeper than Matlab; perhaps no steeper than Mathematica for what you're doing), but very powerful environment.

    2. Re:Well.... by ByronEllis · · Score: 2

      Additionally Matlab (R for certain) is more likely to have pre-existing code written by Those Who Know What They Are Doing so you don't have to reinvent the wheel.

  3. Mathematics Software by Spock+the+Baptist · · Score: 2

    Well you could do what my cousin Patti does when she hits the mall, and say...

    I'll take them both, and charge it! ;)

    Seriously,

    I've no idea of the budgetary constraints that you're under, but you ought to consider getting both of these software packages, given that you're doing real science. Further, as you're doing medical science the imperative is all the greater to get your research, and analysis right.

    Double, triple, and quadruple checking your work is the way to go. Thus, analysis via more then one software package is *quite* advantageous.

    FWIW

    --
    "Oh drat these computers, they're so naughty and so complex, I could pinch them." --Marvin the Martian
    1. Re:Mathematics Software by larien · · Score: 2

      Better yet, get some preview licenses from the companies for evaluation, do a quick run of some sample sets you want to test and then spend the money on the one which works best for you. At the very least, buy a single license for each and test them, but you should try to get eval licenses if you can squeeze the vendors properly.

    2. Re:Mathematics Software by cougartoo · · Score: 1

      Ah, yes, excellent suggestion. I can certainly get demo licenses from Matlab. You will be able to try the full version for a limited period of time (say, 30 days). If you're truly focused on getting a computing package, this should be plenty of time to do a proper evaluation. I don't know if Wolfram does a similar thing for Mathematica, but I'd be surprised if they didn't.

  4. both reasonably good by MarvinMouse · · Score: 2, Interesting

    I found Mathlab to be the more commonly used program, while Mathematica has more features. (but I haven't used either enough to be an authority.)

    I have though found another product, Maple, to be a quality mathematics program. Perhaps you may want to consider that one as well.

    --
    ~ kjrose
  5. Maple 8 by Euzechius · · Score: 2, Informative

    At out university ( Kuleuven (Belgium) ) we always use Maple. It's a pretty complete mathematical application. It's about the same as Mathematica (a bit easier). I think we use it instead of other software because of the lower licensing fees involved.

    1. Re:Maple 8 by Anonymous Coward · · Score: 0

      Maybe, but I know for a fact that much of your medical imaging research community there is using Matlab. Since the OP asked about medical data processing, it matters little what the undergrads
      are using

  6. mathematica or matlab ? by Anonymous Coward · · Score: 0

    i have never encountered a situation where i needed one over the other. both of them have all the possible functions one can think of. both have extensive add-on packages (image processing, statistical package etc).

    both has its uses. however, matlab has good programming support. especially if you want to make an executable using their libraries. making a gui is also easy, since it comes with a vb like programming interface.

    i use mathematica exclusively for doing symbolic math. it's possible in matlab also, but not as pretty. some alternatives to mathematica are mathcad and maple. an open source alternative o matlab is octave. check out

    http://www.octave.org

    both have good plotting abilities. in mathematica you can have plots in the same notebook window however plotting in matlab involves switching between windows (since it opens a new figure for each plot..making a subplot is ok ..but not as convenient).

    in conclusion, if you are doing a lot of symbolic math or want to have plots in the same window use mathematica. if you want a convenient programming interface, use matlab.

  7. Matlab vs. Mathematica by Salis · · Score: 3, Informative

    I've used both and I usually prefer Matlab over Mathematica, although I started using Matlab first so that could be a bias.

    Here's my breakdown of the main differences (to me):

    Matlab is great for numerical simulation of _anything_. It offers the ability to go very quickly from model developement to programming and implementation to analyzing the results. Matlab has a very good GUI creator and offers _very_ good ordinary and partial differential equation solvers. Matlab's programming language is very similiar to C/C++ and it has the ability to link with C/C++ programs.

    Matlab's original use was for the quick calculation of Matrix algebra. (MATrix LAB) You can do a lot with matrice algebra and matrix operators. If your application uses matrices, matlab will speed up the processing and computation by quite a bit, which includes ODEs and PDEs.

    Mathematica, I found, has a slightly higher learning curve because of the symbolic language syntax. It can analytically solve very complex problems and display the results graphically pretty easily.

    Matlab seems to have more additions in the form of modules that come with the professional version. The source code for all matlab functions and modules are viewable, making modification of the modules/core functions possible.

    Honestly, I haven't had as much experience with Mathematica, but I find that most research groups choose matlab for numerical solutions/simulations and mathematica for analytical solutions.

    The best way to make an intelligent choice is to pick up/browse Wolfram's book on mathematica (he created it) and the latest Using Matlab manual. Just remember that Matlab also contains about two dozen extra toolboxes/modules that were created by research groups for specific purposes. There is a neural network toolbox, if I remember, although I don't know if it's applicable to Bayesian networks.

    Salis

    --
    Favorite /. tagline: "On the eighth day, God created FORTRAN." And it was good.
  8. Try the Free alternative by Col.+Klink+(retired) · · Score: 3, Insightful
    GNU/Octave is a free (libre) Matlab clone. There's also Scilab, which has a Matlab-like syntax. Finally, Maxima is now GPLed so you can explore that as well.

    Scilab is mostly free, but still not free-enough to be included on Debian (it is packaged under non-free on a Debian system). See this thread for details.

    --

    -- Don't Tase me, bro!

    1. Re:Try the Free alternative by cougartoo · · Score: 1

      Octave is great if you've got the time, will, and skill to support it; if you're in a professional environment, I don't recommend it. For some reason, even though it's been around for years now, a community does not seem to have developed around Octave as has happened for other free/open software. The consequence is that Octave is not nearly as stable, bug-free, and feature-rich as is Matlab. Of course, Matlab costs BIG bucks, so there are trade-offs to be made.

    2. Re:Try the Free alternative by Anonymous Coward · · Score: 0

      The utexas.edu website is old and out-of-date. Current Maxima development is hosted at maxima.sourceforge.net.

    3. Re:Try the Free alternative by Anonymous Coward · · Score: 0

      I agree to some extent. I've not had problems with bugs in Octave and I've found that Octave works very well. Octave code can generally be run in Matlab, but the converse is nolonger true. The main thing that I think is lacking in octave is multidimensional arrays and structures. Octave only handles up to 2D matricies and no Matlab-like structures.

      Both are very easy to extend with custom C/C++/FORTRAN77 code.

  9. Comparisons of Mathematica, Maple, Matlab, etc. by Pingster · · Score: 2, Informative
    Lots of people have talked about this question before. Here are some pointers I found that might be helpful...

    I'm sure there's a lot more; try some Google searches: maple mathematica matlab, maple vs mathematica, "computer algebra" comparison.

  10. Why would you need either? by MarkusQ · · Score: 2, Troll

    Realistically, why would you need either? You can't be getting your data out to more than a few digits; even a single/short float would be overkill. So, for that matter, is machine learning...

    I guess I'll rephrase this as a question: just what are you hoping that the math package will do for you? I'm not asking for buzzwords, just a plain-talk statement of the problem you are trying to solve.

    -- MarkusQ

    1. Re:Why would you need either? by cougartoo · · Score: 1

      The formal question you pose is reasonable. However, I must take issue with your first point. You are correct in observing that one should obtain similar answers regardless of the package. However, as in so many other professions, tools matter! I can write in a few lines of Matlab very complicated expressions requiring hundreds of lines of pure C/C++. There are dangers in trying to roll your own libraries (despite it being a useful learning experience); serious numerical analysts don't recommend it. There are support issues (what if you change your algorithm slightly--which environment allows simple modifications?), re-usability issues, etc., etc. This said, I *do* write things in high-level, compiled languages (recent versions of Matlab are actually a member of this group) when I need speed in focused areas. It's always worthwhile to use the right tool for the right job.

    2. Re:Why would you need either? by MarkusQ · · Score: 2

      The formal question you pose is reasonable. However, I must take issue with your first point. {...don't reinvent the wheel...] It's always worthwhile to use the right tool for the right job.

      The main point you make is quite reasonable; however, I think you have missed mine. Before you can determine "the right tool for the job" you must first know what the job is. From what he's described, I'm not sure that either package is the right tool.

      Why?

      Imagine the question was:

      • I deliver newspapers in a rural community. I need to keep good maps of my route in case I get sick and my brother need to do it for me. I also need to keep track of how much people owe me. Which package would you recommend... I'm a choreographer and I'm working on tracking our troup's performances, as well as planning/developing new dances. Which package would be best... And so forth...
      The point is, unless we know what he's actually trying to do, it's hard to answer his question. Is he collecting statistics from trial groups? Is he attempting to model bonding site affinity/sensitivity/selectivity or something from 3d molecular models? Is he trying to reverse engineer some chemestry from blood samples? Is he trying to count the spots on a hundred and one petri dishes? Is he trying to judge the statistical significance of a micro-array test? What, in short, is the problem?

      -- MarkusQ

  11. my opinion of matlab by bbc22405 · · Score: 2

    Matlab is "The Revenge of FORTRAN".
    (I don't know Mathematica; perhaps it is also.)

    1. Re:my opinion of matlab by cougartoo · · Score: 1
      A few versions ago, Matlab, indeed, had a crappy language. In fact, I used to keep a long list of all the things I hated about, and all the stupid problems with memory usage, issues in the interpreter, etc., etc. But Matlab 6.x is a significantly different environment. It is essentially a high-level programming language, albeit one targeted at numerical computing. If it was once, it is no longer Fortran's revenge.

      As for Mathematica, one could hardly find an environment farther from Fortran.

  12. My answer by CanadaDave · · Score: 2

    Mathematica rules, if you are actually going to purchase some software, Mathematica is a better buy for your money. Mathematica is fully featured, whereas with Matlab I have always found that I end up needing something from the add-on packages. Matlab is far too close to C/C++ type programming, that I actually think it is much more cost-effective to just use Java along with some graphing package avaiable for free (Ptolemy for examle). There are also lots of numerical packages for Java (colt for example). Mathematica is better to buy because there is no real free alternative, and it is very powerful. Another alternative which has been mentioned already is GNU Octave (which is totally free and aims to imitate Matlab). So my point is basically that Matlab doesn't really do much special that can't be done with C/C++ or Java (if you get the right libraries), and for everything else, Mathematica fits the bill. I never use one package only, but I find that Java/Mathematica is the best combination for me to do everything I would ever need to do.

  13. Mathematica|Maple vs Matlab == Theory vs Practice by mstrcat · · Score: 2, Informative

    As a graduate student, I use all three packages on a frequent basis. Here is a quick decision tree that models how I decide which to use:
    1) Is the problem symbolic or numeric?
    numeric -> Matlab
    symbolic -> Mathematica
    symbolic & pretty graphs needed -> Maple

    2) Do I need to write a program to do the calculations?
    yes -> matlab
    no -> any

    Matlab has a great debugger. you can step through your program single step, into/out of sub programs, or until breakpoint. Mousing over a variable displays it's current value. I find it so useful, that even if I'm doing something in C/C++, I will write most of it in Matlab just to use the debugger, then cut/paste the routines into the project.
    Matlab also has very good low-level read/write routines for reading data into it. This can be a huge plus if you need to automate your data input. Matlab is very well supported for collecting data from many types of devices, rather than typing everything in by hand.

    3) Am I analyzing numbers to discover new relationships or applying data to known formulas/algorithms?
    Discover New -> Complex -> Maple
    -> Simple -> Matlab
    data into formula -> Matlab
    Matlab has very good data fitting for standard curves (polynomial, exponential, trig). I find it just general enough to be what I need in 99% of the time. Maple is a wiz at finding symbolic fits to data with complex relationship, but is much more difficult to use.

    As you can see, I end up using Matlab for about 95% of my work. Between it's easy programablity, shallow learning curve, simularity to C (you can literally copy the guts of a c/c++ program, use search and replace to correct the operators, and have it run in matlab). With the symbolic tool box it nearly equals Maple for symbolic power (it actually uses the Maple symbolic engine, go figure), and the debugger is top-notch. Matlab has very good documentation, and great electronic documentation. It has above average support from the company, and the matlab newsgroup is active and generally produces intelligent solutions/comments. There are any number of 3rd party books written about matlab (the best, imho, is Mastering Matlab) to help as well.

    As for your license strategy, I'd suggest a site license for Matlab and a small number of Maple licenses for people that actually do the symbolic computation (if anyone). Giving everyone access to Matlab makes it easy to share work, share graphs, ect.

  14. [offtopic] Gershwin by divbyzero · · Score: 2

    I know this is offtopic, but Markus doesn't have an email address posted. Please forgive me.

    > "DEG DED {DE}F ED CBCA..." (George Gershwin)

    This signature has been bothering me for months. The theme sounded familiar, but I couldn't quite place it. Finally, I found it about a third of the way through the Rhapsody in Blue. The reason I didn't get it right away was I was humming the wrong rhythm. It would be a lot easier to identify if you weren't missing a note! Try "DEGG DED {DE}F ED CBCA..." or better still "DEGG-DEDF---ED--CBCA".

    Musically,
    Div.

    --
    But my grandest creation, as history will tell,
    Was Firefrorefiddle, the Fiend of the Fell.
    1. Re:[offtopic] Gershwin by MarkusQ · · Score: 2
      IIRC, that theme occurs several places, sometimes with stutters or other ornaments; I don't recall off hand what part of the score I copied it from though.

      -- MarkusQ

  15. MATLAB shall inherit the earth by sandwichmaker · · Score: 2, Informative

    now that I have your attention.
    I have been using matlab for almost exactly an year now and my primary occupation is doing various kinds of machine learning and computer vision related stuff. I have used Mathematica for doing simulations of chemical reactors in the past, so I have some experience with it.

    If you are going to deal with experimental data, and your needs include lots of data visualization MATLAB is truly the way to go. People who like to refer to matlab as just another matrix language miss the point. Just about anyone can put a interpreter around LAPACK and give you a matrix language. What makes MATLAB so popular and powerful is the availability of very high quality libraries and the fantastic visualization tools that come with MATLAB. It is a good idea to invest in a good set of toolboxes when you buy you matlab license. Plus there is a ton of free stuff out there.

    Writing iterative code used to be quite slow, but with the latest MATLAB release mathworks has included a JIT compiler which can convert some not all of your loops to machine code and give you quite a bit of speedups.

    The C interface is clean, and very easy to learn. You can add existing C libraries or write new code and integrate it into your matlab setup very quickly.

    The matlab programming language itself has an extremely powerful syntax. You will be surprised how much you can do in a line of matlab code.

    Finally, if you need to do symbolic computations, there is the symbolic computations toolbox, which I as far as I recall is a wrapper around a maple interpreter, so you have the full power of maple available in MATLAB. I have used it and its pretty good.

    My experience with Mathematica suggests that unless you are going to deal with mathematical structures, and do a lot of symbolic computation in particular, you are better of using like MATLAB.

  16. Syntax Error... Matlab -or- Maple vs Mathematica by green+pizza · · Score: 3, Interesting

    I would suggest doing some more research about Matlab and Mathematica (as well as Maple).

    Matlab is mostly used for creation of and use of complex algorithms, DSP simulations, and other "heavy math" tasks. It's a great swiss army knife and integrates easily with most C compilers for compiled-performance (rather than interpreted). One of the many "modules" included with Matlab is a symbolic math package based on the Maple engine (see below).

    Mathematica and Maple are little more than symbolic math packages. (Don't get me wrong, they can do A LOT, but neither comes close to the full Matlab package). Each has its pros and cons, but either will do quite well for any math undergrad university student and most grad students. The merits of Mathematica vs Maple are often heavily debated on the usenet and in other forums.

    Matlab, Mathematica, and Maple are all very powerful packages... they can do **WAY** more than any of the lame "MathCAD" type apps you probably used in high school.

    All three are available for Windows, Mac OS X, Linux, and most flavors of Unix (Solaris, AIX, IRIX, HP-UX, Tru64). Each has a rather simple interface and "looks" like a native application with the exception of the Linux/Unix version of Matlab -- it's a quick port from Windows with some lame crossplatform toolkit. Its GUI widgets look as though they're straight out of Windows. This cannot be changed without a lot of hackery. Despite the ugly interface, I would recommend Matlab for students... the student price is about the same as that of Mathematica or Maple, yet includes so much more (plus all of the symbolic math features straight from Maple 8).

    If you don't need (or don't want) all that Matlab offers, Maple may do the trick for you. I used Maple 6 for years and only recently moved to Matlab (for compatibility reasons). Maple, even the current Maple 8, is a clean lightweight application. It's easy on the disk and ram, and even easier on the CPU. And, (IMHO), it does just as much as Mathematica would for me.

    Also, all three have a full-featured command line interface alternative to their GUIs. Learning how to key in equations without the mouse and tool palettes will help you in the long run -- you'll be able to enter data much faster. Brushing up on TeX and/or MathML will also prove helpful.

    These days, my workstation runs little more than Matlab, LyX, and sometimes Framemaker.

  17. coding from scratch or using tools? by whoisthatdog · · Score: 1

    There are a lot of packages out there that will do bayesian analysis for you, if you have a fairly standard type of problem (ie you'll be doing EM with exact inference via junction tree or some approximate algorithm). A good list is here. Many of these packages have source available.

    In general, as has been noted by everyone else, Mathematica is great for symbolic analysis, and Matlab is great for numeric analysis. Most people I've talked to in the field use Matlab.

    I've been doing some Bayesian analysis recently and I've been writing everything from scratch in R, since it's free so I can use it at home. If you will be doing the whole shebang yourself, and you have the funds, I'd advise going with Matlab, since it tends to be more stable and well supported than R.

    If you are interested in R, here is a page about the project to integrate graphical models into R.

  18. Majore? by Anonymous Coward · · Score: 0

    Another majore difference between the two ...

    Hey, grammer_nazi, you misspelled "major"!

  19. You might also want to look at MuPAD by jpn · · Score: 1

    If licensing costs are an issue, you might want to look at MuPAD. It has many of the features of Mathematica, but is free for personal use.

  20. Not a troll, darn it! by MarkusQ · · Score: 2

    In case the troll moderation has confused the original poster (on the assumption that you're actually reading the thread you started):

    I am not a troll. I mean my question seriously. What are you trying to do?

    Without knowing that, it's hard to answer your question.

    -- MarkusQ