Hacker News new | ask | show | jobs
by 4thaccount 2621 days ago
Octave and Scilab are more Matlab like replacements as a user below commented. Sure both are for mathematical code, but Octave is more for numerical work and Mathematica for Symbolic computation.

However, Mathematica is powerful in a much bigger way than Octave. Mathematica is more like a very successful and commercial lisp in that it has zillions of composable and we'll documented functions for everything. You don't just copy in a link to an image you want to do something with, but can literally copy paste an image into a function and immediately do stuff with it in a way I've never seen before. Recently I wanted to draw up pretty advanced network diagrams using the images our vendor used. I simply copy pasted them in and then used the graph theory primitives to draw a diagram. Then I noticed that I wanted to add a different picture and it didn't match the color scheme of the vendor. No problem...I just passed it to yet another Mathematica primitive to invert the colors. This was all REPL like interactive and easy to do. There are lots of little commands like this. My favorite example is a file open command that works on over 100 file types. The obvious ones like CSV, XML, JSON, .XLS, & TXT are all there, but so are other file formats like .MPS optimization files, common biology file formats, weather forecasting file types. Chaining this together is insanely easy. Suppose you want to solve a linear programming problem and you have a .MPS file. Just open the file and wrap it in the LinearProgram[] command and then wrap in a FileOutput[] command if I want to write to a text file. There's a lot more for Python where I have to import libraries and write loops.

Mathematica ain't perfect though. It has a large runtime and doing more complicated work doesn't scale as well as I would like for writing big programs. Code distribution is also harder. Nobody else on my team is going to want to install the Mathematica runtime to run my code.

Overall it is pretty nice though and I think it would surprise most HN users.

1 comments

I’d love to see a write up of how you handled that network diagram scenario. It’s been years since I used Mathematica, and my main use was exploring cryptography and cryptanalysis. That need isn’t there for me these days, but I might jump back in if I had a sense of how to use it to handle general purpose diagramming tasks.
It wasn't too bad. If you look up the Mathematica GraphTheory primitives for building diagrams it is pretty simple.

To give an example of a diagram showing love interests you create a variable for each person and set is equal to a picture of them.

Then, you simply create a map that represents each of the relationships like Jerry <-> Alice to show that Jerry and Alice like each other, Jerry->Samantha to show Jerry likes Samantha, but it isn't returned and so forth.

At the end, wrap it all in the command to create the diagram (there are lots of them) and you're done.