Mathics: How To Do Hard Math When You’re Not An MIT Janitor

Algebra is the bane of many a student, but it is surprisingly useful when it comes to electronics. Sure, you can just memorize all the permutations of things like Ohm’s law. But it is better if you can remember one form and deduce the others on the fly.

There are many occasions where you — as our old Algebra teacher used to say — need to use what you know to get what you don’t know. The gold standard, of course, is a computer program called Mathematica. For home and student use, the software is “only” about $160-$600, but commercial versions range from about $1,000 to nearly $8,000. Of course, there are free alternatives, and the one we’re looking at today is Mathics. It will run in your browser or as a desktop application powered by Python, and it’s available for free.

The program does a nice job of displaying mathematical formulae and you can get an idea of its power by visit the online version. which has examples if you click the question-mark in the upper right and look for the fourth item down. There’s also a standalone version of the online help.

We did have a little trouble with some of the gallery examples timing out, as well as the site certificate being expired. We also had a bit of difficulty remembering the linear algebra classes we took a long time ago! If you want something easy to play with try this:

Solve[4x+3==20,x]

Don’t forget to press Shift+Enter in the browser to get the solution.

Under the hood, MathJax and SymPy do a lot of the heavy lifting. In fact, we imagine a lot of the program’s intended audience would wind up using Jupyter notebooks with Python underneath. Of course, there are copies of Wolfram software on stock Raspberry Pi’s, too.

Computer Algebra For Electronic Design

Don’t get me wrong. Like most people, there’s nothing I enjoy more than solving a long, involved math problem by hand. But, sometimes, a few pages of algebraic scratches on paper is just a means to an end. I find this especially true during electronic design sessions, be it circuit design or PCB layout; I just need the answer, and any time spent finding it distracts me from the larger task at hand. For me, at least, this seems to happen at least once a week, and about five years ago I decided to do something about it. I had heard of computer algebra packages, of course, but they weren’t taught as part of the undergraduate engineering curriculum when I went to school. So, I set about learning one: let the computers do the math!

The package I chose is wxMaxima, a document-based front-end to the Maxima computer-algebra system. Descended from code originally written in the late 1960s, it’s a general-purpose package supporting symbolic computation for algebra and calculus. There’s solid, mature code underneath with a modern UI veneer on top. Plus, it’s FOSS.

As I’ve progressed, I’ve found that some additional functions make the Maxima environment especially convenient for circuit design. A few are simple enough that I’d typically just re-create them as needed, so I never really got organized – there were several versions of my “library” floating around on various machines. I finally got my act together, cleaned up the most-frequently used functions, and put them into a GitHub repo.

Let’s have a look at how we can use them to take the tedium out of math for some design problems.

Continue reading “Computer Algebra For Electronic Design”