 Alan
Posts: 10215
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Mathematica vs Matlab vs Maple, discuss

QuoteOriginally posted by: diogenesQuoteMathematica 4.2:{6.672 Second, Null}CPU: P4 3.6,XP,2 GBYou need to upgrade, dude Actually, I am still on Mathematica 5.0.If folks with 6.x could run this problem, would be interesting to hear results.
Last edited by Alan on December 19th, 2007, 11:00 pm, edited 1 time in total. AVt
Posts: 1074
Joined: December 29th, 2001, 8:23 pm

### Mathematica vs Matlab vs Maple, discuss

still would like to hear about exactness of results, a rapid but false one is not worth muchthe determinants are quite huge, so the condition numbers are high, I get ~ 15000 with Maple Alan
Posts: 10215
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Mathematica vs Matlab vs Maple, discuss

QuoteOriginally posted by: AVtstill would like to hear about exactness of results, a rapid but false one is not worth muchthe determinants are quite huge, so the condition numbers are high, I get ~ 15000 with MapleWell, here's a small test in Mathematica using these 300 x 300 random matrices. I create them, invert them, and multiply the original by the inverse to get A, ideally a diagonal of 1's.Then, I check to see how many of resulting 90000 elements of have |elem| > eps (off-diagonal)or |elem - 1| > eps (diagonal)I took eps = 1.0 10^(-13). I did this for 20 trials. The Count is the number that exceed eps, if Count > 0.The Worst is the absolute value of the maximum offender (or Abs[1 - elem] for diagonal elems).Some trials have Count = 0 and so are not in the list. The results:Trial, Count, Worst-------------------------------------{3, 27240, 7.3 x 10^-13}, {4, 81288, 1.0 x 10^-11}, {5, 12057, 2.9 x 10^-13},{6, 9382, 3.4 x 10^-13},{8, 1, 1.1 x 10^-13}, {10, 4601, 2.6 x 10^-13}, {11, 5, 1.1 x 10 ^-13}, {16, 3, 1.2 x 10^-13}, {17, 7540, 3.2 x 10^-13}, {18, 6, 1.2 x 10^-13}, {19, 8, 1.1 x 10^^-13}, {20, 83261, 8.1 x 10^-12} AVt
Posts: 1074
Joined: December 29th, 2001, 8:23 pm

### Mathematica vs Matlab vs Maple, discuss

Hm, I use the max norm for M*M^-1 - id and working with 14 Digits precision I get ~ 1.0e-12 for this,which means, one is loosing at most 2 digits (while Maple is quite quick, inverting is faster than 0.1 secfor d=300 as dimension for the matrix).No, I meant the series, but have not good idea for that
Last edited by AVt on December 20th, 2007, 11:00 pm, edited 1 time in total. AVt
Posts: 1074
Joined: December 29th, 2001, 8:23 pm

### Mathematica vs Matlab vs Maple, discuss

If X = M^(-1).(exp(-t*M)-exp(-T*M)) then err := exp(t*M).M.X + exp((t-T)*M) - idshould be zero, id = identity matrix and all of that in a matrix sense, where Mis the mentioned square matrix (dim=d, entries uniform in 0 ... 1), t=1/4,T=2).Working with 14 Digits (which is more or less expected precision using compliedversions) up to d ~ 30 everything more or less is fine in Maple and with d=50one looses ~ 3 or 4 digits in precision (increasing with d, as one expects).For d=300 I get 2.3 ... 256535 as range for entries of err (while all should be 0),90% are larger than 10^4, 50% are larger than 10^5 while the entries of X livein 0.002 ... 575 (approximate numbers of course).Sounds like a nightmare to work with usual double precision for such stuff, andthat's what for example Matlab will do, I guess. MCarreira
Posts: 1724
Joined: July 14th, 2002, 3:00 am

### Mathematica vs Matlab vs Maple, discuss

QuoteOriginally posted by: AlanQuoteOriginally posted by: diogenesQuoteMathematica 4.2:{6.672 Second, Null}CPU: P4 3.6,XP,2 GBYou need to upgrade, dude Actually, I am still on Mathematica 5.0.If folks with 6.x could run this problem, would be interesting to hear results.Version 6.0.1 running on a Intel Core2 Quad 2.66Ghz 64bit 4Gb RAM Vista Ultimate (with the background stuff on):M = Table[Random[], {i, 1, 300}, {j, 1, 300}];t = 0.25; T = 2;Timing[Inverse[M].(MatrixExp[-M t] - MatrixExp[-M T]);]{0.188, Null}Mathematica Benchmark: 3.21 Alan
Posts: 10215
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Mathematica vs Matlab vs Maple, discuss

QuoteOriginally posted by: MCarreiraQuoteOriginally posted by: AlanQuoteOriginally posted by: diogenesQuoteMathematica 4.2:{6.672 Second, Null}CPU: P4 3.6,XP,2 GBYou need to upgrade, dude Actually, I am still on Mathematica 5.0.If folks with 6.x could run this problem, would be interesting to hear results.Version 6.0.1 running on a Intel Core2 Quad 2.66Ghz 64bit 4Gb RAM Vista Ultimate (with the background stuff on):M = Table[Random[], {i, 1, 300}, {j, 1, 300}];t = 0.25; T = 2;Timing[Inverse[M].(MatrixExp[-M t] - MatrixExp[-M T]);]{0.188, Null}Mathematica Benchmark: 3.21Very nice! Ok, "matlab is much faster than mathematica" guys -- there is the line in the sand
Last edited by Alan on December 29th, 2007, 11:00 pm, edited 1 time in total. gkalman
Posts: 2
Joined: August 29th, 2007, 6:42 pm

### Mathematica vs Matlab vs Maple, discuss

Isn't the real question not how fast one inverts a matrix, but more in terms of interpretive execution speeds?I.e., both Matlab and Mathematica have a precompiled routine for doing it underneath. (Most likely both use some enhanced version of BLAS.) I think all you really tested there is which compiler optimization options were selected by the vendor and how those jive with the particular machine.The real question is when someone writes a program (with loops and if statements) that to some degree utilizes the numerical capabilities, how fast is the total package? I am not talking about compiled versions, reason being if one is going to take the time and need to compile, one may think about C++ or FORTRAN. The reason one uses these packages is for ease of prototyping and that is the native interpretive usage.Very slow interpretive performance was a big issue with MATLAB before they went to Java just in time architecture and fixed that problem, but gained others. Don't know what Mathematica does. I don't know the answer, but my two cents about what the question is all about. colonelzentor
Posts: 1
Joined: February 27th, 2008, 3:04 pm

### Mathematica vs Matlab vs Maple, discuss

On a Dell D620 laptop (2.0 Ghz Centrio Duo, 2 Gb RAM) w\ XP Pro:Mathematica 6.0.1: First run: 0.312 seconds Second Run: 0.281 secondsMatlab 7.2.0 (R2006a): First Run: 0.448 seconds Second Run: 0.443 secondsClearly both are plenty fast enough. I have been using Mathematica now for about 2 years and I initially chose it over Matlab because it seemed a lot easier to call the Java code that I had created for my thesis. I was looking for a simple means to add higher level analysis capability to my Java simulation code; I needed good data fitting and graph theory packages and I wasn't able to find any Java based ones the met my needs without a lot of extra coding. Initially I was really impressed with how the notebook interface enabled me to script my Java simulation code, interactively run and analyze the output and then summarize my results all in one document. To my knowledge Matlab does not have anything like the notebook interface. Plus if you do create a lot of other code in say Java or .Net and want to be able to call that code from Mathematica or Matlab and vise versa call your Mathematica and Matlab code from Java, Mathematica is your only choice. There doesn't seem to be any easy way to call Matlab code from Java. I think the two way street is very handy, I will often prototype an algorithm in Mathematica, recode it in Java and use J/Link to call the Mathematica prototype in my Java unit tests to validate the Java code. While the notebook interface is good for exploratory coding and analysis, it isn't a very good development environment. Prior to Mathematica 5.2/6.0, Matlab's m-file editor was much better for coding and debugging. But now that WRI has release the Wolfram Workbench for Eclipse, as far as I'm concerned, there is no comparison. The Workbench is far superior to the m-file editor. The workbench plus the notebook interface makes for a very potent development and analysis combination. And since the workbench in in Eclipse, mixing Java projects and code with Mathematica projects is trivial. In fact now I pretty much do all my development in Mathematica because the new free MathPlayer enables me to deploy any custom analysis tools that I create without having to buy any expensive complier addons. Clearly the cost of Mathematica and Matlab is not trivial and now that I'm starting to working for myself I am reluctant to drop the $2500 on Mathematica. But after a thorough review of all the open source alternatives (Python+scipy, Octave, SciLab, Maxima, R, etc ), all of which seem very capable and would probably meet my numerical needs, I've decided what you are really paying for with commercial tools like Mathematica and Matlab is the documentation, support and the polished interfaces. Numerically speaking Scipy, Octave and Scilab will do what either Mathematica or Matlab will do, and Maxima seems equally capable as Mathematica in the symbolics arena. But none of those tools seem to have as good of documentation and interfaces\IDEs as Mathematica. I try use as many open source tools as I can but sometimes its just worth it to pay the money. A few days of consulting pays for the$2500 pretty quickly, and if it makes you more productive then its money well spent.Anyway that is my argument for Mathematica over Matlab and commercial versus open source. I'd like to hear other opinions because I can always change. exneratunrisk
Posts: 3559
Joined: April 20th, 2004, 12:25 pm

### Mathematica vs Matlab vs Maple, discuss

colonel..Agree!We have now integrated hundred-thousands of lines of Mathematica, C+, Java code, with computational grid support, data base accessand web front-end. We use the workbench intensively. To describe comprehensive tasks, we have created a kind of "uniform risk analytics task model" described in Mathematica.Every interaction pattern is transformed into this model.But also, when a complete task is performed (say, HTML calls Java calls Mathematica cals C++, or SQL), we create a Mathematica notebook automatically, which describes each single step in the system symbolically.This notebooks can be evaluated in Mathematica and tell us everything about the operational semantics of the task in the hybrid environment.This shortens development, integration and support cycles significantly.We are passionate about hybrid programming (choose languages and tools based on fit for purpose criteria), and Mathematica is our "operating system"for this.
Last edited by exneratunrisk on February 27th, 2008, 11:00 pm, edited 1 time in total. Fermion
Posts: 4486
Joined: November 14th, 2002, 8:50 pm

### Mathematica vs Matlab vs Maple, discuss

Do any of these programs (or any others available) provide a means (either in the standard package, or as an add-on) for manipulating SDEs? (E.g. Ito's lemma, Ito integration, computing the transition density -- symbolically where possible -- and/or its moments.) MCarreira
Posts: 1724
Joined: July 14th, 2002, 3:00 am

### Mathematica vs Matlab vs Maple, discuss

Computational Financial Mathematics using Mathematica is a good reference for SDEs, and has code. Steve06
Posts: 129
Joined: March 29th, 2006, 9:07 pm

### Mathematica vs Matlab vs Maple, discuss exneratunrisk
Posts: 3559
Joined: April 20th, 2004, 12:25 pm

### Mathematica vs Matlab vs Maple, discuss

I know, all of the related systems are developing fast.I have only deeper experiences with Mathematica.We are now intensively using Mathematica 7.Its major enhancement is: built-in parallel computing for the multi-core revolution (more local parallelization) and (networked) pools of compute processes (the original "definition" of Grid computing at CERN) where each computer announces its availability and can be accessed in parallel.In principle Mathematica seems to go the direction of integration instead of tool boxes.(IMO) If, where is Mathematica fundamentally different?- automation in computation, development and visualisation- integrated symbolic computation - unified symbolic representation (everything has a symbolic representation)- multi-paradigm programming- document centered interface
Last edited by exneratunrisk on April 19th, 2009, 10:00 pm, edited 1 time in total. Rufus
Posts: 191
Joined: January 18th, 2002, 5:24 pm

### Mathematica vs Matlab vs Maple, discuss

QuoteOriginally posted by: MCarreiraComputational Financial Mathematics using Mathematica is a good reference for SDEs, and has code.This book is quite old now and is based on version 4.1 of Mathematica (v7 is current). Is there an alternative more up-to-date book out there?[EDIT]Found a threadApologies!
Last edited by Rufus on February 8th, 2010, 11:00 pm, edited 1 time in total.  