Why I use Mathcad

Flattr this!

A new blog mem­ber asked “Why do you use Math­cad?” in response to my most recent post about using some of the funds donat­ed by vis­i­tors to the blog to help fund my research.

It’s a very good tech­ni­cal ques­tion, and one that deserves more than just a reply to the com­ment. So I’ll try to explain why here.

I build dynam­ic mod­els of the econ­o­my using sys­tems of ordi­nary dif­fer­en­tial equa­tions. There are many pro­grams that sup­port this these days, from pub­lic domain pro­grams like Scilab to com­mer­cial giants like Math­e­mat­i­ca and Math­cad. I’ve tried most of them, and I’ve stuck with Math­cad for two rea­sons:

Its inter­face is very nat­ur­al; and

Its error mes­sages are easy to inter­pret.

I’ll try to illus­trate this with sim­u­la­tions of the same sys­tem in both Math­cad and Math­e­mat­i­ca. First­ly, here’s a suc­cess­ful out­put from Math­e­mat­i­ca of my sim­plest endoge­nous mon­ey mod­el with growth and a cred­it crunch:

And here’s the same mod­el in Math­cad:

Though there’s much more that you can do with Math­e­mat­i­ca graphs, I find the Math­cad dis­play more intuitive–more like what a math­e­mati­cian would write on a sheet of paper, which is pre­cise­ly Math­cad’s design phi­los­o­phy.

But the main dif­fer­ence comes with the next fea­ture: the error mes­sages the two pro­grams gen­er­ate when, as so often hap­pens, you make a mis­take in your ear­ly attempts to sim­u­late a mod­el. In this instance, I have typed “ss” where I meant to type “s” in a par­tic­u­lar func­tion. Here’s Math­e­mat­i­ca’s reac­tion to that:

Huh? What does “NDSolve::ndinnt: Ini­tial con­di­tion 400. ss is not a num­ber or a rec­tan­gu­lar array of num­bers” mean? That’s a triv­ial exam­ple, and of course I already know, but when you’re craft­ing a com­plex mod­el and make an acci­den­tal mis­take, it can be non-triv­ial exer­cise to locate the error–even if it is in fact a triv­ial one like this.

Now here’s the same error in Math­cad, and the first stage of its reac­tion:

Ahah! I have an (as yet uniden­ti­fied) unde­fined vari­able! I click on “trace error”, and get the next win­dow. If there was a cas­cade of errors, the “Pre­vi­ous” but­ton would be high­light­ed, but since there’s only one, when I shut this win­dow down Math­cad puts the cur­sor right on the offend­ing “ss” vari­able.

This makes devel­op­ing and debug­ging a mod­el in Math­cad an order of mag­ni­tude eas­i­er than in Math­e­mat­i­ca. I know that Math­e­mat­i­ca is the more pow­er­ful sys­tem, but that pow­er comes at a cost of a much more opaque error cor­rec­tion inter­face.

If these errors were parsed by the pro­gram, so that it did what Math­cad did in iden­ti­fy­ing the source of the prob­lem, then I could quite eas­i­ly con­sid­er devel­op­ing ini­tial­ly in Math­e­mat­i­ca. There would be advan­tages here–notably the abil­i­ty to export equa­tions direct­ly to TeX for jour­nals that require that for­mat, but many many oth­ers.

But until that hap­pens, I make an engi­neer’s choice to choose the most effec­tive tool rather than the most pow­er­ful or ele­gant one.

Bookmark the permalink.