Hot answers tagged

35 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 ...
user avatar
  • 2,950
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. ...
user avatar
29 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: ...
user avatar
  • 2,106
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 ...
user avatar
  • 227k
17 votes
Accepted

Quit the Kernel and start new session automatically

This can be relatively easily done using extremely useful $FrontEnd option "ClearEvaluationQueueOnKernelQuit" introduced by ...
user avatar
  • 133k
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 ...
user avatar
  • 171
16 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 ...
user avatar
  • 227k
16 votes
Accepted

Detecting kernel initialization

Apparently, Throw is deactivated during kernel initialization. The following function can determine if Throw is inoperative: <...
user avatar
  • 67.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 ...
user avatar
  • 227k
15 votes

What information is sent to Wolfram Research when loading or working with Mathematica?

There is a setting in Mathematica that controls whether it can access the internet. Go to Preferences -> Internet Connectivity and uncheck "Allow the Wolfram ...
14 votes
Accepted

Difference between Evaluation ► Quit Kernel and Quit[]

You cannot Quit kernel while evaluation is still running: the Quit[] command will be placed in the queue and executed only after ...
user avatar
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 ...
user avatar
  • 227k
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, ...
user avatar
  • 25.1k
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 ...
user avatar
  • 227k
13 votes
Accepted

How to restart computation when kernels die?

Assuming FrontEnd survives, prepare 3 cells: ...
user avatar
  • 133k
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 ...
user avatar
  • 25.1k
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 ...
user avatar
  • 227k
12 votes

Kernel crash after idle in version 10.0

Now that the workaround has worked for me for days without crash, let me put it as an answer myself. The crash (at least in my case) is because of the kernel tries to connect to internet and something ...
user avatar
  • 7,187
12 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: ...
user avatar
  • 25.4k
11 votes
Accepted

Why am I getting a kernel crash on Chop?

The crash may be avoided by turning off the Suggestions Bar. The reason is that one of the computations attempted by the predictive interface in the background, namely ...
user avatar
  • 25.1k
11 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. ...
user avatar
  • 227k
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.
user avatar
  • 211
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 ...
user avatar
  • 111k
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 ...
user avatar
  • 227k
10 votes

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-...
user avatar
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: ...
user avatar
  • 8,571
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 ...
user avatar
  • 16.8k
9 votes

Restarting Mathematica automatically

On Windows you can run your cycles in a batch file like this: ...
user avatar
  • 29.5k
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 ...
user avatar
  • 45.6k

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