Hot answers tagged

36 votes
Accepted

Why doesn't Mathematica abort evaluation when I tell it to?

There are two processes running. The first process is the FrontEnd. The FrontEnd receives your keypresses and renders text and plots. The second process is the Kernel. The Kernel receives commands ...
Eric Towers's user avatar
  • 2,980
33 votes
Accepted

Is the renaming mechanism of `With` flawed?

Short answer The local variables of the form varname$... are used by the system, and it is unwise to use symbols with such names as local variables. ...
Leonid Shifrin's user avatar
30 votes
Accepted

How can I evaluate untrusted Mathematica code in a sandbox?

You should consider using the sandbox functionality. You can create a subkernel and put it in sandbox mode this way: ...
Stefan R's user avatar
  • 2,126
20 votes

Restarting Mathematica automatically

You could launch a different kernel and use that to run the computation. You will be controlling this "slave kernel" from another Mathematica session. This will allow you to script even quitting and ...
Szabolcs's user avatar
  • 232k
17 votes

How to restart computation when kernels die?

One approach would be to run the evaluation in a second kernel which is controlled from a main kernel through MathLink/WSTP. Then your main kernel can detect if the MathLink connection dies. You can ...
Szabolcs's user avatar
  • 232k
16 votes

How can I evaluate untrusted Mathematica code in a sandbox?

I have been solving exactly the same problem about 2 years ago (http://community.wolfram.com/groups/-/m/t/125587?p_p_auth=aZGMz5bs). Students are uploading piece of Mathematica (Wolfram Language) code ...
Zdenek's user avatar
  • 171
16 votes
Accepted

Detecting kernel initialization

Apparently, Throw is deactivated during kernel initialization. The following function can determine if Throw is inoperative: <...
WReach's user avatar
  • 68.3k
16 votes
Accepted

High Fibonacci numbers

The kernel crashes due to stack overflow. It is not safe to recurse too deeply. Increasing $RecursionLimit to values that are too great (and actually recursing ...
Szabolcs's user avatar
  • 232k
14 votes

Detecting kernel initialization

After some spelunking, I found a file which contains a lot of initialization code, including reading the kernel init.m file, loading ...
Szabolcs's user avatar
  • 232k
14 votes
Accepted

VideoPlay crashes the Kernel with Mathematica 12.1

This bug has been fixed by a paclet update. This would be applied automatically whenever the functionality is used in a new kernel (as long as the paclet manager has updated its local site index, ...
ilian's user avatar
  • 25.4k
13 votes

Saving data inside a notebook so that I don't have to run it again?

In Mathematica 11.3 or later, use Iconize. It creates a short display form of a large expression that can be copied to elsewhere within the notebook, can be saved ...
Szabolcs's user avatar
  • 232k
13 votes
Accepted

How to restart computation when kernels die?

Assuming FrontEnd survives, prepare 3 cells: ...
Kuba's user avatar
  • 136k
13 votes
Accepted

Handling Kernel start. What is a full initialization stack and what place the Autoload has there?

Update Leaving my original answer below for historical purposes, however it only applies up until version 11.1.1. As of version 11.2.0, the kernel startup initialization has been overhauled and this ...
ilian's user avatar
  • 25.4k
13 votes
Accepted

Why does args symbol exist in a fresh kernel?

It's a type of otherwise harmless bug that tends to come and go with versions. I would suggest to report it to Wolfram, but also not to worry about it. Notice that the symbols have no associated ...
Szabolcs's user avatar
  • 232k
13 votes
Accepted

Using Terminal` (ASCII plots) in Wolfram 12

Here's an approach to fix the code behind Terminal` - Execute the following code to restore the functionality of the package: ...
Lukas Lang's user avatar
  • 33.4k
12 votes

Saving data inside a notebook so that I don't have to run it again?

Update: I maintain the latest version of this function on my blog. SaveToCell is a convenience-minded implementation of Vitaliy's idea. The code is at the end. ...
Szabolcs's user avatar
  • 232k
11 votes

The most simple Manipulate freezes the notebook on v10.1

I had this problem and the solution was to turn off the Suggestions Bar in the preferences.
Damien's user avatar
  • 211
11 votes
Accepted

What is the cheapest method to get cloud computing, remote kernels, HPC access, connection to clusters or GPUs?

The remote batch job submission functionality in version 12.2 of Mathematica makes it easy to run batch jobs on cloud services like AWS Batch. See this example illustrating a trivial job using multi-...
Jesse Friedman's user avatar
10 votes
Accepted

Any ergonomic tools for the command line kernel?

As I said in my comments, it is hard to implement this correctly if you aim for some advanced Dynamic features that work in the command line. However, you can ...
halirutan's user avatar
  • 112k
10 votes

Complete list of documented symbols that require a front-end?

I cannot give you an exhaustive list of symbols, and I think it is even debatable what it means that "a symbol requires the FE". But I think I can try to help with this: I think it is important to ...
Szabolcs's user avatar
  • 232k
10 votes

Using Terminal` (ASCII plots) in Wolfram 12

Note After looking through the referenced python code, it stands to reason that all of the tools are available from within Mathematica. I have yet to fully debug this sub-answer. You can take ...
bobthechemist's user avatar
9 votes
Accepted

Is there a way to monitor the memory used by mathematica as a dynamic expression?

This might come close to your need; Dynamic[Refresh[MemoryInUse[], UpdateInterval -> 1]] This will update every second the amount of memory used by the kernel....
user8074's user avatar
  • 1,572
9 votes

All value types for a symbol?

Thanks to the link to "Copying one symbol into another" in jkuczm's comment, I found a partial answer with Language`ExtendedDefinition. For instance: ...
Reb.Cabin's user avatar
  • 8,651
9 votes
Accepted

mathematica does not evaluate without internet access?

No, you only need the Internet connection if you are using Wolfram|Alpha to enter your inputs, because this is a web service. If you had typed the Mathematica input ...
9 votes

Global context seems to be shared between kernels when using Clear?

If you look at the definition of NotebookEvaluate, by means of Needs["GeneralUtilities`"]; GeneralUtilities`PrintDefinitions[NotebookEvaluate] you see that the ...
Rolf Mertig's user avatar
9 votes

Restarting Mathematica automatically

On Windows you can run your cycles in a batch file like this: ...
Chris Degnen's user avatar
  • 30.6k
9 votes

Clean package update for API/FormFunctions on Wolfram Cloud

Edit: For more on this Context trick see this: Importing an mx file into a context And just as full disclosure here's a note on it circumventing ...
b3m2a1's user avatar
  • 46.6k
8 votes

Why doesn't Mathematica abort evaluation when I tell it to?

The situation has already been explained by Eric Towers in more detail and clarity than I would have been capable of, but as far as a solution goes I think I have a slightly better one: How do I ...
Mr.Wizard's user avatar
  • 269k
8 votes
Accepted

Choose the number of kernels used by ParallelTable

You can launch as many or as few kernels as you like, see LaunchKernels and CloseKernels. Parallel functions will use as many as ...
Szabolcs's user avatar
  • 232k
8 votes

Choose the number of kernels used by ParallelTable

Another way from the menu (if accessible): Edit $ \rightarrow $ Preferences $ \rightarrow $ Parallel $ \rightarrow $ Local Kernels $ \rightarrow $ (Number of local kernels to use) Manual setting
Αλέξανδρος Ζεγγ's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible