Wolfram Mathematica — My Love Story

From WM to Python and back to WM

(29 Sep 2024)

I work professionally as a FEA-stress engineer and I constantly use programming as a support tool for my main engineering tools (which are variations of CAE-software like ANSA, FEMAP, NX Simcenter and others).

Languages I use as of today:

  • General: WM, Python/Hy
  • Other: Grasshopper, VimScript, AutoHotKey

So, my experience is twisted into functional, visual and small-scripting side.

In short:

Phase I — First Love (WM)

When I started working as a stress engineer, I had lot’s of secondary math tasks, that I had no instrument to solve, so I remembered that my friends at University used WM during education, so I started using it.

I programmed WM somewhere around 2014..2021, and was using it for solving everyday math tasks, building interactive GUI for many of them. I then developed Upwork Career on top of it starting from 2018.

Phase II — Resentment

Eventually (2021) I grew tired of some big WM drawbacks:

Also, Python was gaining popularity,

Phase III — Procedural world (Python)

To say I was shocked by procedural and OOP paradigms is an understatement:

As of today I view Python as «at least no worse than 3/5 but in literally everything».

But back then dissatisfied with procedural experience, I stared looking into taking formal training in computer science and programming, continuing to work in Python in parallel.

Somewhere there I randomly stumbled upon Scheme and LISP and saw infamous «LISP Curse» be similar to my WM experience.

Eventually I started using Hy — python LISP-dialect (essentially it is just a Python, but with LISP-style sytax; so all Python libs and functions are supported in Hy). It promissed to be a better of 2 worlds: python rich ecosystem and LISP functional paradigm.

Phase IV — recreating WM in Python (Hy)

As you can imagine, I was list-comprehending all over the place. It was much MUCH more closer to programming style that felt natural to me, but I still missed «term-rewriting» part of WM.

I tried PyQt and also really liked DearPyGUI as a GUI lib, but compared to WM it was to slow to build with. And also required lot’s of architectural thinking even for a small app.

Since I felt OOP to be cumbersome, I then turned my view to functional programming (FP) and I learned that «real» FP is not about functions «Map/Apply». Rather, structural operation like «Map» are better attributed to APL-like languages.

And «real» FP is more about pure functions, monads and state-less programming.

Deep understanding of monads seemed to be impossible without Haskell, so I started to learn it (again in Parallel to Python/Hy).

My plan was to learn some Haskell and get back to Hy with knew knowledge of monads.

Phase V — Back to WM

I was again shocked when I read article on Xae Lee website, that stated that WM was based on LISP and APL — 2 main languages that I discovered during my «WM Resentment» journey.

By this time, I clearly saw that I started making WM from Python using formula WM = Hy/LISP + APL + Haskell. I just thought to myself «what the heck», and since during this journey I gathered lot’s of understanding of what cons and pros are imported for me, I was able to decide to finally be back to WM.