Mathematica for free

In this post I’m going to try to capture the steps I took today to get a Jupyter Notebook to run Mathematica commands. I did it on a Windows laptop so if you’re on a Mac of Linux you’ll have to make appropriate adjustments.

Why free?

Mathematica is not free. A single license can be over $1000. Student versions are more like $200 but there’s no question that it’s pricey, especially when compared with python-based computing. Of course, it definitely has value! The amount of development that’s been poured into it, including just in the last few years, is amazing. Want easy to use neural networks? Check. Want lightning fast prototyping? Check. Want access to tons of curated data sets that all play well together? Check.

But, ugh, what a cost. And it’s hard to convince students to embrace it if they know they’ll lose it as soon as they graduate. I’ve spent lots of time looking for a replacement for the types of things I tend to work on, and it’s been a mixed bag.

But ever since I noticed that Wolfram (the company that makes Mathematica) put a free mathematica kernel (what they now call a Wolfram Engine) on the Raspberry Pis, I started keeping an eye out for ways to use the Wolfram Engine for free.

If you go here you’ll see that you can download the engine for developers and use it for free as long as you’re not trying to make money with it. When you download it and install it you can then run wolframscript in a cmd window and you get old-school command-line Mathematica. Graphics don’t work but general calculations do.

To get a more useful interface, you can pair it with a Jupyter Notebook. These are free interfaces that people mostly use to do Python programming. But you can swap out the kernel from Python to Wolfram Engine with the steps that I outline below.

So the kernel (Wolfram Engine) is free (assuming you’re not trying to make money) and Jupyter Notebooks are free. Off we go!

Installation steps on Windows

  1. Download and install the Wolfram Engine
    • You’ll have to register on their site (for free) to get it to work.
    • Run wolframscript in a cmd window and it’ll ask for your login credentials for Wolfram.
  2. Install python
    • Note, I couldn’t get this to work with Anaconda, so I uninstalled Anaconda and separately installed python, pip, and jupyter
  3. Install pip
    • Go to “Method 2” on this page
    • Make sure to install it in the same folder where python is.
      • To figure that out, run py on the cmd line and run this code:
>>> import os
>>> import sys
>>> os.path.dirname(sys.executable)
  1. Install Jupyter
    • in that same directory, run this code: pip install jupyter
  2. Download the paclet
    • Go to this website
    • Then go down to “Assets” and download the file called WolframLanguageForJupyter-x.y.z.paclet (for me x=0, y=9, z=3)
    • Make sure to save it to the same folder where python and pip are now installed
  3. Run a few commands in command-line mathematica
    • In that directory, run the wolfram engine with this command: wolframscript
    • In Mathematica run these commands one at a time:
      • PacletInstall["WolframLanguageForJupyter-x.y.z.paclet"] (make sure to use the right x, y, and z)
      • Needs["WolframLanguageForJupyter`"] (note the extra back tick toward the end there)
      • ConfigureJupyter["Add"]

And you’re done! Now you just need to run jupyter by typing jupyter notebook on the command line and it should launch a new tab in your browser (it takes about a minute on my machine, it seems). Then you can select a new file using the Mathematica kernel:

Finally, here’s a youtube vid of me using it (showing how to model a 10-pendula)

Your thoughts?

I’d love to hear your thoughts. Here are some starters for you:

  • This is cool! My favorite part is . . .
  • This is dumb. The dumbest part is . . .
  • Why don’t you italicize Mathematica?
  • Can it do Manipulate commands? (sort of)
  • Can it access the curated data? (haven’t tried yet)
  • Why didn’t you do an 11-pendulum? Jerk
  • I can do all this a lot easier with scipy, loser.
  • Can you write this up for Mac users?

About Andy Rundquist

Professor of physics at Hamline University in St. Paul, MN
This entry was posted in computational data science, mathematica, programming, teaching. Bookmark the permalink.

12 Responses to Mathematica for free

  1. This is awesome! I can confirm these steps just worked for me on a Mac and with an Anaconda installation.

    • Andy Rundquist says:

      That’s so great! I’m glad it worked with Anaconda. I finally just gave up and went with this route. Hope you’re enjoying it!

  2. bretbenesh says:

    This is an extremely valuable post. Thank you!

    • Andy Rundquist says:

      You’re most welcome! Were you using Jupyter with your sabbatical last year?

      • bretbenesh says:

        Yes! It is one of my favorite bits of free software out there.

        I have always stayed away from Mathematica for the reason you said—students are unlikely to have access to it after graduation. Your post makes it possible for me to even considering using Mathematica.

  3. Wilson Kins says:

    Another way to get Mathematica for free is to buy a Rapberry Pi. You can install the GUI and the CLI versions. I suggest that unless you have a Pi 4, you stick with the CLI. The Pi 4 will run the GUI version, but it is slow.

  4. Pingback: Constraint forces for path in 3D | SuperFly Physics

  5. Matt says:

    This is a pretty great tutorial. I got pretty far. I’m personally a Pycharm user and I got the environment to work inside my project file so it can all be zipped up and loaded onto another system.

    One issue I’m getting is the Jupyter Notebook loses connection to the Wolfram kernel running inside my venv environment. That and the fact that I suck using both, I can’t get those clean looking graphs to show. But still, great idea and worthy of sucking down a ton of time as I try to figure out how to get it to work cleanly in Pycharm.

    • Andy Rundquist says:

      I’ve never used pycharm, looks cool. One funny thing about my setup is that I still haven’t bothered to figure out how to work anywhere outside of the …\AppData\Local\Programs\Python\Python3.1 folder. A pain to constantly have to navigate there that I’m still bearing.

      • Matt says:

        The only added benefit to working inside your virtual environment for Pycharm is to be able to share all the files and move them from one machine to the other. I’m going to see if I can zip it and move it to my work pc for ease of setting it up on all machines I want to use it on.

Leave a comment