# Tag Info

27

While it is true that you can not save a full state of the kernel, in some cases it may be enough for your purposes to save all symbols' definitions in some context(s), such as Global (or whatever other contexts are of interest to you). This can be done via DumpSave, like DumpSave["state.mx", "Global"] The .mx file generated by DumpSave will be ...

13

In the days when computers were slower, and the kernel took a long time to start up (in wall time), a little package was made to help with cleaning up without having to restart the kernel. This package is still included with Mathematica, and is found in AddOns\ExtraPackages\Utilities\CleanSlate.m (within the Mathematica installation directory). It is more ...

11

There is an easy way to keep your data in the notebook itself and NOT to save them in external file - using Compress. As @Leonid says here and I already mentioned this before in this answer for similar case with Interpolation function. Start from some output you need: sol = NDSolve[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0, u[t, 0] == Sin[t], ...

11

I use a shortcut key Ctrl+Q for Quit[], allowing rapid clearing of all sessions variables. Here is how you can add this to Mathematica: You will be editing KeyEventTranslations.tr. This is an important system file so be careful. Start by copying the file you are going to edit from the $InstallationDirectory to$UserBaseDirectory in the same tree. This ...

8

I have the following commands in my init.m file, which can be found in $UserBaseDirectory/Kernel/init.m. eraseAll := ClearAll[Evaluate[$Context<>"*"]]; eraseAll::usage="eraseAll clears all values, definitions, attributes, messages and defaults associated with symbols in the current context" removeAll := Remove[Evaluate[$Context<>"*"]]; ... 8 The option to save a variable, a value, in a notebook, that I find simple and deserves a chance is to store them in the notebook's tagging rules. You can compress it if you want, or you can autoload it through an initialization cell or through the NotebookDynamicExpression too. The core is this: r = RandomReal[{-1, 1}, 1000000]; ... 6 There's a related question with interesting answers, where I suggested storing in the notebook's tagging rules. Just use something like this as a variable CurrentValue[EvaluationNotebook[], {TaggingRules, "myvars", "x"}] and it will be stored in the notebook, so it survives kernel crashes. If it's something big however, I would probably use DumpSave before ... 5 As an alternative to DumpSave, what I've done in the past was to Compress the relevant results and store them within the same notebook. You can optionally set things up so that your data/results would self-uncompress themselves upon being called the first time. For one example of such use, see this answer. In any case, the advantage of this approach is ... 3 Some fancy ways have already been posted, but I'd like to mention the simple ones. Per Notebook Use an Initialization Cell (Cell > Cell Properties > Initialization Cell) for code that should be evaluated any time you first evaluate code in the Notebook in each session. Globally Use the Kernel\init.m file (FileNameJoin[{$UserBaseDirectory, "Kernel", ...

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