Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Mathematica vs. Matlab? 37

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?
This discussion has been archived. No new comments can be posted.

Mathematica vs. Matlab?

Comments Filter:
  • by jbolden ( 176878 ) on Sunday January 05, 2003 @05:11PM (#5021233) Homepage
    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?

    • 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.

    • 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.
    • 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.

  • Well.... (Score:3, Informative)

    by ByronEllis ( 22531 ) on Sunday January 05, 2003 @05:21PM (#5021275) Journal
    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 [r-project.org], 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.
    • 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.

      • 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.
  • 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
    • 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.
      • 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.
  • 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.
  • Maple 8 (Score:2, Informative)

    by Euzechius ( 600736 )
    At out university ( Kuleuven (Belgium) [kuleuven.ac.be] ) 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.
  • by Salis ( 52373 ) on Sunday January 05, 2003 @07:43PM (#5022116) Journal
    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
  • by Col. Klink (retired) ( 11632 ) on Sunday January 05, 2003 @07:50PM (#5022167)
    GNU/Octave [octave.org] is a free (libre) Matlab clone. There's also Scilab [inria.fr], which has a Matlab-like syntax. Finally, Maxima [utexas.edu] 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 [debian.org] for details.

    • 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.
  • 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 [google.com], maple vs mathematica [google.com], "computer algebra" comparison [google.com].


  • 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

    • 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.

      • 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

    • 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.

      • 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


    • 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

  • Matlab is "The Revenge of FORTRAN".
    (I don't know Mathematica; perhaps it is also.)
    • 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.

  • 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.
  • 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.

  • 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.

  • by green pizza ( 159161 ) on Monday January 06, 2003 @02:18AM (#5023751) Homepage
    I would suggest doing some more research about Matlab [mathworks.com] and Mathematica [wolfram.com] (as well as Maple [maplesoft.com]).

    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.
  • 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 [mit.edu]. 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 [r-project.org], 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 [r-project.org] is a page about the project to integrate graphical models into R.
  • If licensing costs are an issue, you might want to look at MuPAD [mupad.com]. It has many of the features of Mathematica, but is free for personal use [mupad.com].

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...