A Comparison Between Differential Equation Solver Suites In MATLAB, R, Julia, Python, C, Mathematica, Maple, and Fortran

Many times a scientist is choosing a programming language or a software for a specific purpose. For the field of scientific computing, the methods for solving differential equations are one of the important areas. What I would like to do is take the time to compare and contrast between the most popular offerings. This is a good way to reflect upon what's available and find out where there is room for improvement. I hope that by giving you the details for how each suite was put together (and the "why", as gathered from software publications) you can come to your own conclusion as to which suites are right for you.

(Full disclosure, I am the lead developer of DifferentialEquations.jl. You will see at the end that DifferentialEquations.jl does offer pretty much everything from the other suite combined, but that's no accident: ... READ MORE

Setting Variables Element-wise in a Matrix in Mathematica

February 2 2016 in Mathematica, Programming | Tags: | Author: Christopher Rackauckas

This is the latest entry on tip, tricks, and hacks in Mathematica. In my latest problem I need to solve for the components of many matrices using optimization algorithms. Mathematica does not allow one to straight pass matrices into the algorithms, so one has to perform the algorithms on variables that stand in for the components. This is what I did with the matrix A1, solving for A[i,j]=A1ij. That was all fine and dandy until I needed to set some of those matrices to constants. I could do a bunch of set commands all lined up, i.e.

A011 = 2;
A021 = 1.4;

But that would be inelegant and hard to ... READ MORE

Simple Parallel Optimization in Mathematica

February 2 2016 in Mathematica | Tags: , | Author: Christopher Rackauckas

A quick search on Google did not get hits for a standard method of parallelizing NMaximize and NMinimize, so I wanted to share how I did it.

My implementation is a simple use of a Map-Reduce type of parallelism. What this means is that we map the same problem out to N many processes, and when they finish they each give one result, and we apply a reduction function to reduce the N results to 1. So what we will do is map the NMaximize function to each of N cores, where they will each solve it on a random seed. From there, each process will return what it found as the minimum, and we will take the minimum of these minimums as our best estimate of the global minimums.

Notice that this is not optimal in all cases: for ... READ MORE

Why is Mathematica Stopping My Long Calculation?

January 30 2016 in Mathematica, Programming | Tags: | Author: Christopher Rackauckas

You set it all up, you know it's going to take a few days, and you run it. You check it a few hours later, it's all good! The next morning... there are no cells computing still?

Mathematica's documentation isn't that helpful for what just happened. If you were using a function like FullSimplify, there are time limits on it. However, it will give you an error/warning if it hits the time limit, so if you ended up with a blank screen with no calculations, that's not it.

This happened to me. I found out that the hidden culprit (for me) was Mathematica's history tracking. The fix is simple, add the following code to the top of your file:

$HistoryLength = 10;

What's happening is that Mathematica saves its entire command history by default. This is ... READ MORE