37
$\begingroup$

I want to buy a license for Mathematica and was checking the prices. Some people on Reddit have claimed that one can get a free a Wolfram Engine and install the Jupyter notebook interface and that is exactly Mathematica; so, one doesn't need to buy an independent Mathematica license. A blog post also claims as much.

Can someone confirm this statement? If it's true, why do people still buy Mathematica?

$\endgroup$
10
  • 2
    $\begingroup$ Unless someone built a purposely designed interface to mimick what Mathematica notebooks produce, I don't see how Jupyter would help beyond a notebook that allows to to execute mathematica code and write comments in between. Mathematica notebooks present graphs etc. based on Wolfram language code. They are a super nice environment, the spirit of which may have inspired Jupyter notebooks. Jupyter has nice capabilities you can use on their own (graph display etc). I can't comment for sure about the absence of a purpose built interface as mentioned above but those are my thoughts on it. $\endgroup$ Oct 5, 2022 at 12:04
  • 1
    $\begingroup$ I read the blog and you can't rotate a graph. The project to mimick Mathematica may well be feasible but will take a lot of time and people developing it. If you can wait years then perhaps you can get a free version that suits your needs. I find that Mathematica teaches me a lot and helps me on with challenging research. A colleague swears by Jupyter in its own right. Evaluate what you need the system for. It will help you decide what to buy or get for free. $\endgroup$ Oct 5, 2022 at 12:14
  • 1
    $\begingroup$ Another aspect I learned after getting into Mathematica is the frequent free courses set up by Wolfram research. I use these regularly now and find them very helpful. You can post questions and they are answered. Your first focus will be on deciding which software you need. Others I am sure will be helpful with identifying differences. If you decide to get a license it is good to know that these courses all are free and well organised. $\endgroup$ Oct 5, 2022 at 12:25
  • $\begingroup$ I am an academic so I use the licence provided by my employer. I don't know which licence would be the best but perhaps add an edit to your question on it. $\endgroup$ Oct 5, 2022 at 12:31
  • 7
    $\begingroup$ I suggest that you set up the free version with Jupyter and try it out for a day. Then download the trial version of the full system and try it again, and see for yourself. The free version is definitely very useful, and Jupyter adds significantly to its usability. But for me it's not an alternative. I wouldn't be able to replace the full version with the free setup for my daily work. $\endgroup$
    – Szabolcs
    Oct 5, 2022 at 12:35

3 Answers 3

30
$\begingroup$

The quality and usability of Jupyter with Mathematica is nowhere near that of the native notebook interface. While using Jupyter is much better than using the "naked" Mathematica kernel from the command line, and may be suitable for occasional use, it is not nearly comparable to using the full Mathematica notebook interface.

It's been a while ago since last time I tried Jupyter with Mathematica, and things may have improved since then, so I will only focus on limitations that I believe cannot be addressed.

With Jupyter, you will lose:

  1. 2D input, i.e. any kind of non-plaintext input such as mathematical notation or graphics.
  2. All Dynamic functionality.

You may think that you would only want to type plain-text code, and you don't need 2D input. Similarly, you may think that you can live without creating Dynamic user interfaces. But these two features are so deeply integrated into Mathematica that the usability of the system suffers greatly if they are not available. Just a few examples of things you wouldn't be able to do:

  • Copy an output, or part of an output, and evaluate it or re-use it as part of another input. With Jupyter, most output shows up as a static image. You can switch to using OutputForm, like in command line mode, or even InputForm, but that reduces the readability of many outputs and makes it difficult to work with graphics.
  • Save outputs with the notebook in a structured and reusable format.
  • In recent versions, non-trivial expressions are shown as "summary boxes" with a [+] button to expand them and reveal more information. These are not only not copyable, but also not expandable or fully readable. See here of how someone was unable to read the result of an integral.
  • Many convenience features will be lacking: Images won't be resizable, 3D graphics won't be rotatable, you won't be able to paste an image into an input cell, read off histogram bar heights from a tooltip, pick coordinates from a plot, etc.

In the past there were other limitations too, which may have been addressed since then, such as the lack of interruption support (which is very important for any sort of interactive work), the lack of auto-completion, or the lack of built-in documentation with immediately runnable examples.


To avoid misunderstandings, it's good to note that with the free Wolfram Engine you do get the full computational functionality. As far I know, there are no noteworthy limitations. Only the user interface will be lacking.

$\endgroup$
11
  • 4
    $\begingroup$ As illustration of Szabolcs points here is a recent video that compares Mathematica and Jupyter notebooks: "Markdown to Mathematica converter (Jupyter notebook example)". (This, of course, is opportunistic self-promotion...) $\endgroup$ Oct 5, 2022 at 14:17
  • 2
    $\begingroup$ @AntonAntonov I just subscribed to your YouTube channel. I guess you will continue to create content, so I'm going to promote your channel with my friends. :-) $\endgroup$ Oct 5, 2022 at 15:39
  • 3
    $\begingroup$ @E.Chan-López Thank you! "[..] I'm going to promote your channel with my friends." -- Yes, please do that a lot and often! $\endgroup$ Oct 5, 2022 at 15:56
  • 1
    $\begingroup$ @Szabolcs The other direction might not be hard to do -- I already have a Raku parser of Mathematica expressions; see the Raku package "Mathematica::Grammar". I "just" have to write the Markdown interpreter. (And troll Kuba with it...) $\endgroup$ Oct 5, 2022 at 17:29
  • 1
    $\begingroup$ @userrandrand, you are correct, after updating various things it seems Echo works now. $\endgroup$
    – rhermans
    Oct 13, 2022 at 10:42
11
$\begingroup$

Contents:

Options to code in the Wolfram kernel within a notebook interface or for package/script development.

Structure of this answer

Part 1 : Pros and cons of notebook alternatives Part 2 : Non notebook alternatives

Part 1: Pros and cons of notebook alternatives

Notebook options

  • Wolfram cloud

  • Wolfram Kernel in Jupyter Notebook

  • Wolfram Kernel in Jupyter Lab

  • Calling Wolfram functions with a Python Kernel in Jupyter

  • Jupyter Notebook inside VScode

Wolfram cloud

Pros/Features:

  • Everything that comes with the newest Wolfram kernel by just going on the cloud without the hassle of installing something on your computer. This can be nice to have even if your institution provides Mathematica as they might not update it right away.

  • Rotate objects

  • Dynamic works

Cons

  • No copying of outputs (that said I did not try using InputForm maybe it works like that)

  • No copying of sub-expressions of outputs

  • It not possible to use external commands like RunProcess or ExternalEvaluate

  • Other limitations: https://support.wolfram.com/53990

Wolfram Kernel + Jupyter Notebook

The official option provided on this github page.

Pros/Features:

-The latest wolfram functions. This can be nice to have even if your institution provides Mathematica as they might not update it right away.

  • Collapsible sections

  • Jupyter extensions and themes.

  • Markdown with Latex (Latex is also possible with Mathematica but I still prefer Markdown Latex)

  • When the command is followed by //TeXForm the Latex output is automatically rendered in Jupyter. This leads to beautiful output especially when compared to the default output which is rendered as a picture with a white background.

1

examples

Using $PrePrint one can consider a function that checks the head of the output and decides whether the output should be rendered in Latex, Image, or plain input text for copying.

  • code indentation

  • less front end freezes than with the mathematica notebook ?

Cons

  • Possibly the biggest concern: As mentioned in Szabolc's answer, interrupting a cell leads to stopping the kernel and so one has to restart everything if a code cell takes too long. Use a=1;Pause[10];0 then interrupt the kernel and then check that a is no longer defined. Maybe this could be partly solved using DumpSave (maybe Save is better) and $NewSymbol by saving all new symbols in a temporary file (maybe in $TemporaryDirectory) so that it is not saved forever (which could use a lot of memory on your hard drive). Other than using the DumpSave method, calling the wolfram kernel from python one could save some of the simpler variables in python like numbers and lists. For more complicated structures see this question or this question

  • No auto-completion or suggestions when writing system defined functions (although see Wolfram Engine + Jupyter $\stackrel{?}{=}$ Mathematica for what might be a fix but I did not test it and do not know if it autocompletes system functions)

  • No documentation on functions when hovering over a function

  • In mathematica one can check the precedence of a symbol using Ctrl+. as it highlights how Mathematica will evaluate the input. This is not possible with Jupyter

  • No Input cells that automatically continue a code line to the line below when it is too long.

  • "Undo" (Ctrl+Z) does not work well for me when I use jupyter notebooks with a python kernel. Perhaps that is also true with the wolfram kernel. In python this was less of a problem in JupyterLab and maybe that is also true for the vscode option below.

  • No 3d image rotation although see this answer for how to use the wolfram cloud to do that within a Jupyter notebook.

  • No 2d input

  • No tooltip descriptions when hovering over plots

  • Using the $PrePrint method before, one can include an option to show the input form if the head is InputForm or a custom wrapper. However, in a large expression it might be irritating find the sub-expression desired when we are more familiar with the TeXForm.

  • No hiding Input cells to show only the output

  • Not possible to have multiple windows with the same kernel

  • If you had a favorite style-sheet in Mathematica I guess you will not be able to use it anymore as the methods below have their own themes.

  • No in place evaluation

  • No free form evalution ?

Wolfram Kernel + JupyterLab

Pros

  • Same as with Jupyter Notebook

  • Collapsible input cells

  • Multiple windows with the same kernel

  • Better "undo" (Ctrl+Z) support on Python and maybe also with the wolfram kernel

  • To be completed

Cons

  • Same as for Jupyter Notebooks minus the pros mentioned before

  • To be completed

Wolfram kernel in Python

There is also the option to call Wolfram functions within Python. This feature can be used in a notebook environment.

Pros:

  • Did not try just an idea: possibility to use tooltip, sliders and animations by using Python on the output from the wolfram kernel.

  • Easy integration with Python functions

  • To be completed

Cons:

  • Same cons of using Jupyter minus the possibility to retrieve some aspects of Dynamic. Images might still not scale well and rotation is probably not possible.

  • Syntax a bit heavy but one can define variables and functions to make the syntax easier.

  • Symbolic output like 5+x^2 and the output from Plot are written in FullForm. One can obtain images (for the expression and for the plot) using ExportByteArray and following the method in this page. Perhaps that can be shortened into a python function. The image outputs from that method look the same as when using directly the wolfram kernel in Jupyter (not calling wolfram kernel functions in python as is the case here). However, TeXForm does not work (it outputs the same FullForm with TexForm wrapped around un-evaluated).

Wolfram functions in a Jupyter notebook with a python kernel in JupyterLab.

wolfram kernel in Python notebook in JupyterLab

  • To be completed

VScode + Jupyter+ WolframKernel

There is a possibility to use Jupyter in VScode.

The instructions are given in this page (probably auto-completion and documentation by hovering over functions will not be available as was the case for Jupyter notebooks on the browser, see the sentence below for a possible solution)

I installed this plugin for VScode where some of the features are auto-completion and documentation by hovering.

(Note : that last plugin did not work for me following the instructions on the Github page but it did work using a .ipynb jupyter notebook and selecting the wolfram language both as the kernel (at the time of writing top right in VScode) and as the interpreter (at the bottom right of a code/input cell, I think the name in this case is from the same plugin).

Pros:

  • Using the language extension of plugin within a ipynb notebook in VScode as the language interpreter (option at the the bottom right of a cell) one has access to auto completion and the documentation by hovering over a function. This is not the attended method of that plugin but the intended method did not work for me and this works somehow.

6

7

  • This might have happened after I initially wrote this but it seems that at least with the extension mentioned before, variables are kept when canceling a cell execution and so one might no longer need to restart the kernel.

  • Nice clean and elegant interface of Jupyter in VScode.

  • Other pros of Jupyter minus some of the extensions maybe (did not try) and minus the Latex Rendering (explained in cons below)

  • AI autocompletion (for example Github copilot)

  • Snippets?

  • Option to stay in same cell with Ctrl+Enter although see Keyboard shortcut for evaluating the current cell while keeping the cursor in the cell for a way to that in mathematica notebooks

  • possibility to use vim keybindings using the vim plugin

  • can select content of a cell (I am not aware of a quick way to that with mathematica)

  • In my opinion it is easier to set keyboard shortcuts when compared to mathematica

  • A comment below seems to say that one can get some of the features of Mathematica such as 3D rotation and animations using the wolfram player but I have not tried this yet.

Cons

  • Cons of Jupyter Notebook with the wolfram kernel minus autocompletion and the documentation. So no usage of Dynamic, no ToolTip, no 3D plot rotation, no image resizing by dragging (but on can set the image size manually with the ImageSize option), etc.

  • expression //TeXForm does not give nice LaTeX outputs with the current version of "Wolfram Language for Jupyter" on VScode. A work around was found on this page. Following the instructions in that answer, it suffices to rename the original RequestHandlers.wl file to something likeRequestHandlers_old.wl (for example) and then rename the RequestHandlers.wl.txt file in that answer to RequestHandlers.wl (maybe one should restart VScode after , maybe also the wolfram kernel, maybe also the computer, not sure).

  • In VS code notebook, can not execute a specific section. Difficult to copy output with a keyboard but possible with a mouse.

  • Difficult to copy with keyboard but possible with mouse

  • input aliases like ‘[[g]]’, → or [Omega] do not show nicely (maybe using one of the extensions mentioned here could help https://github.com/microsoft/vscode/issues/171074)

  • No Interpretation ?

  • No Iconize

Note: Maybe it might also be possible to call a wolfram function inside of a python kernel within the environment of a jupyter notebook inside vscode. I did not try.

Part 2: Non notebook alternatives

Direct questions**

TL;DR: use wolfram alpha

One might want to find the answer to a somewhat simple problem that can be easily understood in one sentence. Examples:

  • prime numbers between 100 and 200

  • integrate x*Log[x] over the interval 1 to 5.7

  • Speed of sound in gas at 500 degrees Celsius

  • mean temperature in Greenland

Such tasks can be solved using natural language with wolfram alpha on the wolfram alpha website.

Non interactive Package/Script development**

TL;DR : I like VScode for package editing

I do not remember if Workbench needs the wolfram kernel or Mathematica. I also do not remember if the Mathematica plugin for IntelliJ IDEA can be used with only the wolfram kernel. I will only mention the option that I personally use which is the official wolfram plugin for VScode. The reasons why I prefer VScode rather than the native package handler or Workbench are that :

  • It is a modern and popular IDE

  • Nice functions/utilities for code editing and viewing definitions of functions

  • Nice code indentation

  • possibility to use a dark theme

  • usual syntax highlighting, documentation by hovering over functions, and function suggestions come with the plugin.

There are two things missing in my mind.

  • A debugger

  • In Mathematica one can check the precedence of a symbol using Ctrl+. as it highlights how Mathematica will evaluate the input. This is not possible with VScode

Package development is not what most people are looking for so

$\endgroup$
2
  • $\begingroup$ I am trying to take the best of all approaches, but building the frontend from scratch is kinda cumbersome. wolfram-js-frontend It is still not usable for a serious stuff, just a demo with Graphics3D. Hope it will manage to bring 2D input using the power of codemirror $\endgroup$ Jan 19, 2023 at 9:39
  • $\begingroup$ So no usage of Dynamic, no ToolTip, no 3D plot rotation github.com/njpipeorgan/wolfram-language-notebook/pull/50 this fix it. $\endgroup$ Sep 16, 2023 at 22:45
2
$\begingroup$

some addition for @userrandrand 's answer

So no usage of Dynamic, no ToolTip, no 3D plot rotation, no image resizing by dragging (but on can set the image size manually with the ImageSize option), etc.

try this small extension https://github.com/asukaminato0721/mmaplayer

Dynamic

enter image description here

Tooltip

enter image description here

3D plot rotation

enter image description here

image resizing by dragging

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.