Slashdot Mirror


Use of Math Languages and Packages in Research?

CEHT asks: "As a research programmer at the university, I have encountered numerous times when I need to choose which language(s) or package(s) to use for different projects. Tradeoffs and performance issues have to be considered: results from one package may be more compatible with the data from other researchers, another package may find the solution faster and use less resources, and so forth. Maple, Matlab, Magma, and Mathematica are among the most well-known packages. Libraries such as IMSL is also popular. Of course, there are smaller (and mostly free) packages that tend to target specific types of problem, such as LiDIA, Singular, and LAPACK. The question is, how useful are these [and other] math packages? Do researchers use only one or two packages for most of their projects? Or do people like to mix things a little by pulling the strength of different packages together to solve a math problem? If not, do researchers write C/C++ programs and use GMP or Matpack to solve math problems?"

41 of 454 comments (clear)

  1. useful by mrtroy · · Score: 2, Informative

    maple and matlab i have found to be useful

    but that is only if u are doing a highly intensive amount of math

    otherwise it takes longer to figure the gui and usefulness out than to figure out the problem on your own

    matlab rules for matrix math

    --
    [I can picture a world without war, without hate. I can picture us attacking that world, because they'd never expect it]
  2. Re:Octave by 2names · · Score: 1, Informative

    I use CHALKBOARD. It rocks. Doesn't use up all my system's resources, no licensing fee, and I can share it among my friends without getting sued. :)

    --
    "I'm just here to regulate funkiness."
  3. a couple other packages by RhettR · · Score: 3, Informative

    I have used a few other packages, command-line utilities, which I find useful: Recently I'm using one for my honors research project (I'm an undgergrad): GAP and another I've used which I like: PARI-GP. GAP tends to deal with group-theoretical functions, and GP tends to deal more with number theory, but both shouldn't be ignored.

  4. What I use (probably different from your needs) by Papineau · · Score: 2, Informative

    For my research in mechanical engineering (more specifically regarding tolerances), I use Matlab since it's what I'm most comfortable with. Maple is also used at my Uni, but I don't have much experience with it (other than it's symbolic kernel since it's available with Matlab) so I don't end up using it.

    It mostly depends on what you're doing. Depending on your area of research, you may find that one of those is more popular because it solves these types of problem better. If speed is an issue for you, you can easily port your algorithm to a compiled language if you prototyped on an interpreter, even interfacing the two in some cases.

  5. MatLab, Mathematica by Pemdas · · Score: 4, Informative
    I'm a graduate student studying robotics. YMMV.

    For most computer vision code, Matlab is a must for prototyping. It's useful in other areas, and, if you know how to use it, reasonably fast. If you're doing particularly involved matrix manipulations, it takes a lot of work to come up with C/C++ code that will work faster then well-written matlab code.

    Personally, I also use Mathematica for doing real math work. If I need to derive something that's particularly complex, then Mathematica's notebook style is really nice to work with, and it makes possible extremely clear and concise mathematical arguments while limiting stupid human errors when doing drudgery like taking derivatives and the like.

    I hear Maple and MathCad are both good, too, but I've never used them.

  6. FORTRAN by Entropy_ah · · Score: 2, Informative

    I'm working on a thesis with a math professor here at school. We're working on a mathematical fiber model which requires a whole lot of computation and a whole lot of data. My advisor does all the computations by writing FORTRAN programs and running them on an SGI Octane. Yeah the language is really old an ugly, but it's still useful for mathematics and its what a lot of mathematicians use in academia.

    --
    my other penis is a vagina
  7. Re:Octave by robbyjo · · Score: 2, Informative

    Although Octave is great to mimic Matlab 5.2, some neat features in Matlab 6.0 are not there yet.

    Another drawback is... just like Matlab... It's Slow, with a capital S. I won't recommend it for serious number crunching like encryption or gene data manipulation unless you have really good CPU power and godly patience.

    --

    --
    Error 500: Internal sig error
  8. Multiple tools? Never! by jkastner · · Score: 2, Informative

    My experience (Ph.D. in applied mathematics, and employment at a mathematical consulting firm) is that researchers only use their favorite package and will rarely use anything else, despite the fact that their favorite may not be appropriate for the job at hand. To that end, I use Mathematica for nearly all my prototyping, except for brief excursions to Matlab which is much better at image analysis. But both of these have speed issues, and when it came down to serious buisness I would often roll my own C,C++ or FORTRAN code for the problem at hand.

  9. Re:Octave by klokwise · · Score: 2, Informative

    hmm, having used octave recently, i have to disagree with you. i grabbed the latest release off the site and only had to update my version of readline to get it to compile. also, i really only see octave being used in an educational or small-time commercial sense. it's great to learn on and give you a taste, but is no where near as efficient as matlab.

  10. Re:Inexact floating point calculations... by dlakelan · · Score: 2, Informative

    Floating point numbers are by their nature inexact. it is impossible to make them exact, though you can make them arbitrarily high precision.

    When people need exact answers they do exact math using a combination of symbolic computations and arbitrary sized integers and rationals.

    ie. the answer you might get from doing an operation like sqrt(2) would be "sqrt(2)", doing an operation like area_of_circle(r=1) would be "Pi"

    an operation like 2^128/3^45 would be some ratio of enormous integers expressed as x/y where x and y are the integers 2^128 and 3^45

    does that help?

    --
    ((lambda (x) (x x)) (lambda (x) (x x))) http://www.endpointcomputing.com a scientific approach to custom computing.
  11. Re:Inexact floating point calculations... by TennesseeVic · · Score: 2, Informative

    Yes, floating point calcs are inexact. That's why numerical mathematicians for agest (well, since 1960-something) have been doing error analysis of programs. Basically, you show that your algorithm will not stray too far under small errors. Some algorithms that look entirely plausible do stray far, so those don't get used.

    Packages that work exact (maple, mathematica) can run only at a fraction of the speed of numerical packages, so big simulations (how high should this airplany engine be mounted) are simply not done that way.

    V.

  12. Re:Octave by SquadBoy · · Score: 3, Informative

    I'm just in one of those moods today.

    apt-get install octave or if you really like to have it build on your box apt-build install octave. :)

    --

    Cypherpunks: Civil Liberty Through Complex Mathematics. Those who live by the sword die by the arrow.
  13. Re:MathCad? by DuckDodgers · · Score: 2, Informative

    I was forced to learn Maple. Maple isn't particularly user friendly, but it's pretty powerful.

    We did, in no particular order: differential equations, groups, rings, RSA encryption, McLaurent series, and matrix manipulation.

    But I can't compare it to any of the other programs because it's the only one I used.

  14. Maxima! by Piquan · · Score: 3, Informative

    I use Maxima for my work. It's a continuation of Macsyma, the computer math program that was the inspiration for Mathmatica. Macsyma was tied up in copyrights for a while, but now it's public domain. So Maxima updated it to modern computer environments, added in a GUI (with web browser) and ties to modern programs like GnuPlot, and now there's a good, open-source symbolic math utility / programming language.

    1. Re:Maxima! by billwgd · · Score: 2, Informative

      It's misleading to call Maxima a "continuation of Macsyma". In the early 1980's MIT Macsyma was forked into a public-domain version (DOE Maxima) and a commercial version (Macsyma). Maxima has had very little development since then, whereas the commercial version has had many significant enhancements, keeping it competitive with Mathematica and Maple. Unfortunately the commercial product is now in limbo since Macsyma Inc. went bankrupt a few years ago.

      For further details see the newsgroup sci.math.symbolic

      Disclaimer: I am one of the developers of Macsyma, both at MIT and later commercially.

  15. Which package... by digitalhermit · · Score: 2, Informative

    Asking this question is no different from asking, "which programming language should I use?" without stating the purpose. Bash is great for scripting a daily ftp get, but inappropriate for drawing graphics.

    I can use Mathematica for almost all of my dabbling. Sometimes I play with MuPAD, R, GnuPLOT, Octave or Mathematica to show a particular problem. Since these are also free (beer or speech, depending on package) I can be reasonably sure that everyone can get a hold of it.

    For example, Octave is suitable for matrix manipulation. It does everything that I need it to do and can replace Mathematica for me. It's also fast enough (the longest calculation has taken just over a minute but it was a huge manipulation of some graphic data).

    I've dabbled with some of the libraries but only for fun.

    I guess what it comes down to is how comfortable are you with the package. By the time I try to write something in C using a dedicated library I can most likely do the same thing in Mathematica in a tenth of the time. Even if the execution speed was 100 times slower, the "real" time may not about to much.

  16. Re:Inexact floating point calculations... by Piquan · · Score: 2, Informative
    As others have mentioned, Mathematica and Maple-- like Maxima-- use symbolic manipulation to give exact answers. For example, Maxima tells me that the integral of x^2+2*sin(x) from -5 to 4 is 2 COS(5) - 2 COS(4) + 63. It can't reduce that further without introducing inexactness from the irrational functions. (If it could, it would; the same integral over -5 to 5 is reported as 250/3.)

    Some math packages and programming languages-- such as Common Lisp-- have bignums (infinitely long, perfect precision integers) and rationals, which are also infinitely long and perfect precision. So the value of (/ 1 3) is not 0.3333, it's 1/3.

  17. Re:Octave by Anonymous Coward · · Score: 5, Informative
  18. Re:MathCad? by franimal · · Score: 5, Informative

    User friendly? Are you talking about the program that I use on a daily basis? Surely not. MathCAD is without a doubt the prettiest of all the options but it is among the worst in user interface.

    For those of you who are not familiar with MathCAD, it works like this:

    Anything and everything that you want to input into MathCAD is in it's own little box. Be it a text or an equation box.

    The horrid part is trying to organize all these boxes on the page. Putting everthing in a box means that it operates completely contrary to what most people are used to with MS Word. Say you enter some equations and then decide you want to add a few more in the middle. You can't just hit the up arrow and start typing with maybe an enter. Instead, you'll often have to select the later equations and drag them down to make room for the new. Then, if you have a lot of equations you likely didn't move all of them down. So, you have to select the equations that now overlap and select 'Separate Regions' from a menu. This gets to be very tedious.

    Furthermore, is it too much to expect MathCAD to figure out that I don't want have my equation on page one and the rest on page two? Why should I have to go and select "Reimpaginate' from a menu before I print?

    Entering equations is no joy either. I'm constantly frustrated when I try and do something as simple as add antoher term to an equation, like changing x^2 - 3 to x^2 + x - 3. I find myself starting over and at times typing 1 + 1 - 1 and then replacing the ones. I mean, come on, I've seen many math typeing solutions that are far better, in MathType, and LyX for example.

    Sure you might have a nice looking document but was it really worth the pain? Furthermore, I find MathCAD to be seriously lacking in function compared to Maple et al.

    Of course, Maple et al. all have their problems with user interface. Why should I have to end with a semi-colon? And you have to realize that it's never going to look the way you want it to. So you have to suck it up and do the math without worrying about the beauty of the output.

    Not to sell MathCAD short, there are some things that it does do well:

    • Units, the best unit management system I've had the joy to use. Very nice.

    • The output is beatiful.

    • Simple math that doesn't require big complicated equations and lots of loops.

    Personally, I can do the easy math by hand. For more advanced stuff check out SciPy.org. They provide a python interface to established numerical algorithms in C and Fortran. But it's much quicker and 'funner' to use. Unfortunately they are only at alpha right now. But, you can't be the price and for the most part, I've found the optimization sections to be quite stable. Combine it with pychart and your've got a good science package for free.

    Otherwise, the only package that I've actually heard people rave about is Matlab.

  19. MATLAB: Costly but extemely effective by NoData · · Score: 4, Informative

    I use MATLAB every day for my neural network simulations. MATLAB is incredibly powerful, incredibly flexible. It is also incredibly expensive. And the decision to port it to OS X was about the best decision The Mathworks has made recently.

    MATLAB offers student versions for about $99 a pop, which is dirt cheap considering its $1000 price tag for the retail version. Many universities of course have dramatic discounts, but then, you have to have be affiliated with a univeristy. Even the student version requires you to attest that youre using it for course work or student-level research and not commercial gain.

    MATLAB has a number of drawbacks. Price is the largest. To enforce its license, MATLAB requires you to run the onerous and clumsy FlexLM license manager. FlexLM is brought to you by GLOBEtrotter....a division of that bastion of consumer rights, Macrovision. That should speak volumes. The license manager makes doing a lot of simple things stupidly difficult, especially if you're (like me) mobile and have to authenticate with a central server running the license manager. I can get into details if people have questions.

    On top of that, MATLAB requires a yearly "maintenance" fee. It's more or less software as a service. Apparently, if you let the maintenance contract lapse, you can still use MATLAB, but you get no more support and cannot apply any new updates. That may be, but the particular license my university employs will cause my copy to simply stop working after April 1 if I don't renew. (April 1 being the beginning of the Mathworks license year. I don't think they see the irony in choosing that date).

    The maintenance contract does not apply, AFAIK, to the student version.

    On top of THAT, the student version or the $1000 base retail installation just gets you the MATLAB core. Which, granted, is extremely powerful. But the Mathworks also has a couple dozen or so Toolboxes, each with a range of specialized functions and tools (i.e. Signal Processing, Image Processing, MATLAB-to-C Compiler, Symbolic Math, etc. etc.). Each of these comes for an additional price, and its own maintenance fees. IIRC, these are like $500-$700 more each.

    Did I mention all these prices are for licenses on a per seat basis? Any institution or company thinking about MATLAB is going to shell out serious bucks for the privelage.

    On the other hand...MATLAB is a serious, extensible, highly flexible platform for technical and mathematical computing. I find that I can prototype programs for solving scientific problems in MATLAB far faster than I can in any other language. And its visualization features are truly impressive...even if the Handle Graphics system it uses is SO DAMN KLUDGY to program. You can customize visualizations just about however you can imagine...ALTHOUGH, some simple customizations are going to be UNNECESSARILY tedious to program.

    Another drawback to programming in MATLAB is speed. MATLAB ("Matrix Laboratory") is exceptionally optimized for handling calculations of very large matrices. However, because it's interpreted, if you have any loops, it's going to be very slow going. There often many tricks to "vectorize" operations you'd normally do iteratively in other languages, but often the only solution is the ol' for-next or while loop. These are slow. Very very slow. Yes, there's a compiler, but in my experience the compiler isn't that great at optimizing code...and, did I mention it costs extra?

    Anyway, MATLAB is amazing in its breadth and depth of power. I haven't even touched on its capabilities for engineers, like the SimuLink system design simulator, and hardware interface toolboxes. I can't imagine a problem needing to use a "mix" of math packages (as the original poster asked) if you're using MATLAB. But the purchase and ownership costs are very steep.

  20. Python by Anonymous Coward · · Score: 2, Informative


    In the past I've used Matlab, C/C++, and a junkyard of Perl scripts to get things done.

    Nowadays I use exclusively Python, with underlying C and C++ components when performance is at a premium. C is easy to call from Python thanks to Swig.

    Python is simply unparalleled in its simplicity and elegance, and I find that I can accomplish most of the things that Matlab is good for from a Python interactive shell using Numeric and the other various scientific Python libraries.

  21. Depends by caseydk · · Score: 4, Informative

    It depends on what you want to do.

    CHALKBOARD is great for addition and the other basic operations, but if you want to do symbolic algebra, Maple or MathCad are your best bets.

    If you want to do some sort of signal processing and/or crazy matrix applications, the Matlab is probably the answer.

    If you want to do something with statistics, Matlab or Minitab are the way to go.

  22. MathForge by Anonymous Coward · · Score: 2, Informative

    MathForge is a project designed to utilize "web services" to provide interfaces to networked and local math tools. The idea being the mathforge architecture "discovers" math services depending on whatever task needs to be done.

    The base of the project is a Java environment on which programmers can build tools as needed.

    It is GPL'ed software.

  23. Re:A problem I've struggled with ... by Dr.+Zowie · · Score: 2, Informative

    I've used IDL a lot and found that it's great for getting the wrong answer in a hurry. The designers didn't spent a lot of time thinking about special cases, so (for example) the built-in interpolation includes unavoidable off-by-one pixel errors. By default, all FOR loops break after 32767 iterations. Structures try (and fail) to be like perl hashes. If you write two double-precision variables to a file and then read them in again (using the default I/O format), you get an egregiously wrong answer. The symbol table combines the worst of global and local lookup: array names collide with global functions, and there's no way to isolate modules (so big projects inevitably produce collisions).

    It's possible to get work done with IDL (zillions of scientists use it), but it's a tragic waste of brainspace to keep all the extra exceptions and pitfalls in mind. Writing robust code in IDL is like kicking a whale carcass across a mined Afghani battlefield.

    Oh, and the license to use it costs about as much as your workstation. I'll take PDL, NumPy, or Matlab any day over IDL.

  24. Scilab by tie_guy_matt · · Score: 5, Informative

    I don't think anyone has mentioned scilab. It is a good GPL alternative (along with octave) to the expensive (expensive if you are a college student) matlab. It has been a while since I played with them alot but I found that matlab had the best graphing functions.

    Anyway the best package for you in part depends on what you are using it for. Matlab, scilab and octave are great for doing linear algebra things -- manipulating matrices and arrays etc. Some people complain about how slow matlab is. I find matlab is pretty fast as long as you use it for what it was designed for. You should use their built in functions as much as possible and use as few loops as possible. If you find yourself using a lot of loops try writing a mex function in C or FORTRAN.

    Maple and Mathmatica are great for Calculus differential equations etc. If you are doing a lot of matrix mulitiplies in Maple, you should be using matlab.

    Mathcad is user friendly but it is SLOW. Even old people who have been doing insane integrals in their heads since the 50's and refuse to even look at a computer can see a Mathcad print out and tell exactly what the program is doing.

    Hope this helps. Personally I like to use Octave and Scilab since they are GPL. Scilab is prettier IMHO but Octave is closer to Matlab (which I am already used to.)

  25. Re:MathCad? by saforrest · · Score: 2, Informative

    We did, in no particular order: differential equations, groups, rings, RSA encryption, McLaurent series, and matrix manipulation.

    Er, you mean either "Maclaurin" series or "Laurent" series.

    A Maclaurin series is the Taylor expansion of a function about 0.

    A Laurent series is like a Taylor series, but with the range of exponents going from -infinity to infinity instead of 0 to infinity.

    (Maple is capable of doing both of these.)

  26. This might be useful ... by Somnus · · Score: 3, Informative
    I've just built it successfully on my Gentoo laptop (everyone seems to rave about, so I thought I'd try it out). Ostensibly, whatever voodoo the ebuild script does works. Here it is:

    http://www.gentoo.org/dyn/pkgs/app-sci/octave.xml

  27. other free software by Anonymous Coward · · Score: 1, Informative

    Think about yacas for symbolic computation and pari for some symbolis computation, high precision calculus with floats and number theory.

  28. Re:Arbitrary Precision Floating Point? by dr2chase · · Score: 2, Informative
    The Constructive reals package by Hans Boehm should work for you. It "sucks bits" from subexpressions as necessary to obtain the output precision that you ask for. Beware of questions that take forever -- with unlimited precision, certain (in)equality questions can never be answered.

    I wrote some code that uses this package to test the quality of the Java Math.sin method, if you would like a starting example.

  29. Maxima can actually be *more* powerful than Maple by ondelette · · Score: 2, Informative

    For example, you can write batch scripts in Maxima a lot more easily than you can in Maple. I have scripts to automatically generate PostScript figures and I'm really not sure I could do the same with Maple.

    Maxima has some bugs, some annoyances, but at least, you can report them on sourceforge and they do get fixed. If not, someone will suggest a work-around.

  30. Too few open-source solutions and minimizers by TopherC · · Score: 2, Informative

    I'm an experimental particle physicist, and most of the mathematics packages I use are home-brew libraries (mostly C++ w/ bits of older Fortran). I think for me a multi-dimensional function minimizer is just about the most complex tool used, and it is used constantly -- tens to thousands of times per day. Unfortunately, it's not a trivial problem and different minimizers will often produce different results. The only one that I know which is semi-free and basically functional is MINUIT, part of CERNLIB (in Fortran). I've recently been searching hard for an open-source minimizer to replace this, written in C/C++. I would also like to see one in Java, for a few reasons (I'd rather an applet than a CGI script).

    The GNU scientific library has a very crude minimizer that's too simplistic for my needs (I want things like the curvature at minimum which can be inverted to give a coordinate covariance matrix). I most often use the minimizer to fit various functional forms to observed statistical distributions.

    I am surprised at the lack of an up-to-date open-source minimizer, because so many university researchers use these kinds of tools, and are in an environment where commercial solutions are painfully expensive and a schism for any multi-university collaboration. A lot of phycisists write good code prolifically, but far too few support/contribute to open-source projects!

    I was reading through Numerical Recipies recently, and was also taken aback by their licensing policies. The algorithms in the book are simple solutions which have been previously published by others in journals and such. And the code is just a direct adaptation (translation really) of the algorithm. Yet somehow their code, or any translations of it, are under copyright? I think it's foul-play like this that are the reason there are so many high-quality commercial mathematics packages, and so few open-source ones.

  31. Absolutely true, Numeric rocks+ JNumeric by ondelette · · Score: 2, Informative

    You can pretty much do everything you want using Python Numeric. It is actually a much nicer language than Matlab if you know your stuff as far as languages are concerned (OOP, functional programming and such).

    Also, there is a port of Python Numeric in java (JNumeric) which means that Numeric is extremely portable.

    All of that for free. Not just free as in free beer too... free as in free software...you can't beat that!!!

  32. Re:Octave by blair1q · · Score: 2, Informative

    No pain at all.

    Download the binary distro of Octave for Windows.

    I just did, now I'm going to go play with it.

  33. Re:Python and Numeric by Chundra · · Score: 2, Informative

    Yeah, numpy rules. Not to name names, but I know some DoE labs use it quite a lot. It's very slick. So are many of the other python number crunching tools.

  34. Re:MathCad? by BitterOak · · Score: 2, Informative
    A Maclaurin series is the Taylor expansion of a function about 0. A Laurent series is like a Taylor series, but with the range of exponents going from -infinity to infinity instead of 0 to infinity.

    Right, so a McLaurent series is like a Taylor series, expanded about x=0, with exponents ranging from -infinity..+infinity.

    --
    If I can be modded down for being a troll, can I be modded up for being an orc, or a balrog?
  35. Re:Maxima by amundson · · Score: 3, Informative
    The utexas.edu site for Maxima is out of date. The new Maxima site is http://maxima.sourceforge.net. The new site has the recently released Maxima 5.9.0.

    We are trying to get the old site to direct people to the new site. Since the old site is not under our direct control, it isn't as easy as one would hope. (I am the Maxima project leader.)

  36. A couple of suggestions by Goonie · · Score: 2, Informative
    GNU maxima is a free symbolic algebra package, roughly equivalent to Mathematica. It's not nearly as tidy, but I've found it handy on occasion.

    If you want to do some statistics, there's also R, a stats analysis package. It's very powerful, but it's designed for experts rather than non-statisticians who occasionally want to crunch some numbers.

    --

    Any sufficiently advanced technology is indistinguishable from a rigged demo
    --Andy Finkel (J. Klass?)
  37. Re:Absolutely, Maxima is very, very useful by amundson · · Score: 4, Informative

    The "maxima community," such as it is, exists on the maxima mailing list. Please follow the links from http://maxima.sf.net for list information, archives, etc.

  38. A Few other packages by pfafrich · · Score: 2, Informative
    The statistical community tend to use R or S or a few other statistical packages. Very effective for large matrix calculations, singular value decomposition and that sort of thing.

    I've done a lot of work in 3D pure mathematical graphics (drawing algebraic surfaces etc), and JavaView and Geomview are nice platforms for viewing 3D data.

    --
    There are four sorts of people in the world: fools, lunatics, idiots and morons. - Umberto Eco, Foucaut's pendulum.
  39. Re:Octave by CanadaDave · · Score: 3, Informative

    The thing I like best about Octave is that includes lots of things that are "add-ons" for Matlab. The the Matlab Control Toolbox, which must be purchased on top of the base package. But Octave includes most of these functions.

  40. recommendations by g4dget · · Score: 2, Informative
    If you are looking for general purpose tools for numerical computing, Numerical Python and Scientific Python are excellent choices, possibly with VTK for visualization (search on Google; the projects are on Sourceforge). Octave is a Matlab clone, although, like Matlab itself, rather limited. The R system (www.r-project.org) is probably the best statistical system around and produces great plots. And for interactive symbolic math, Maxima is still very good (and you can use "texmacs" as a nicer interface to it).

    Don't underestimate the power of C++: with type checking and overloading, C++ may actually be more convenient to use for many numerical applications that even something like Numerical Python or Octave/Matlab.

    Beyond that, yes, obviously, all those libraries are in use by someone if they are maintained. If you have the need to use one of them, you will know. If not, don't worry about it.