Skip to main content
29 votes
Accepted

How do I disable the stack tracing feature in Mathematica 11?

Is there a possibility to disable stack tracing, but keep messages? Internal`$MessageMenu = False reverts back to the old messages. Seems to do the trick and ...
ktm's user avatar
  • 4,242
27 votes

Why does removing a function and defining it on the same line not work?

Executing Trace on an expression reveals what is actually happening: ...
dan7geo's user avatar
  • 1,410
26 votes

How do I disable the stack tracing feature in Mathematica 11?

Analysis current as of Mathematica version 11.0.1 and 11.1.0. We can disable the Show Stack Trace item in the new message menu as follows: ...
WReach's user avatar
  • 69.1k
16 votes
Accepted

How to clear all definitions matching f[1, ...] but not f[2, ...]?

You can modify DownValues[f] directly. For example ...
Simon Woods's user avatar
  • 85.1k
13 votes
Accepted

Good clearing practices

I'd like to summarize the discussion that took place in comments, since I think this is an important question, and a common source of frustration when lingering definitions cause weird behavior that ...
MarcoB's user avatar
  • 67.4k
12 votes

Good clearing practices

Actually I think "good practice" would be to try to write code which would make the use of Clear, ClearAll or ...
Albert Retey's user avatar
  • 23.6k
10 votes
Accepted

Why does removing a function and defining it on the same line not work?

I use the word internal symbol rather than just symbol, to make it easier to distinguish between the name of a symbol and the internal representation of the symbol inside the kernel. I felt I should ...
Jacob Akkerboom's user avatar
10 votes

Different strategies to get a clean Kernel. Quit, Exit, ClearAll, Remove, CleanSlate?

PREVENTION This is a Community Wiki answer, experienced users are welcome to add to it and correct mistakes. Best practice is to avoid the need to clean the kernel at all, by avoiding the creation ...
10 votes

What is the difference between Clear and Remove?

To see the the difference, try: a = 1; f[i_] := a + i f[1] 2 Clear[a] f[1] NameQ["a"] 1 + a True ...
Sjoerd Smit's user avatar
  • 23.8k
9 votes

ThrowAway Environment and Scoping

You can block $Context and then read your file: ...
Carl Woll's user avatar
  • 131k
9 votes
Accepted

Why ClearAll[n] does not clear effect of NumericQ[n]=True

You can undo this using NumericQ[n] =. (Note that there is no space between the = and the ...
Szabolcs's user avatar
  • 236k
9 votes

Different strategies to get a clean Kernel. Quit, Exit, ClearAll, Remove, CleanSlate?

NEW KERNEL This is a Community Wiki answer, experienced users are welcome to add to it and correct mistakes. To get a fresh kernel for the current notebook, one can either kill the current kernel ...
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
  • 17.2k
8 votes

Apply Clear puzzle

I would store a list of the variable symbol names instead of the symbols: vlist = {"foo", "bar"}; foo = 1; bar = 2; Clear @@ vlist foo bar foo bar If ...
Carl Woll's user avatar
  • 131k
8 votes

How do I clear all user defined symbols?

I usually initiate a unique context for each notebook via the option under Evaluation > Notebook's Default Context > Unique to This Notebook. In this case, you can remove symbols of your notebook's ...
a06e's user avatar
  • 11.4k
8 votes

How does one clear the value of a subs variable?

Welcome to MMA SE! In general please post code instead of images. Short answer: Subscript[a,0] =. (That's Unset in the docs.) ...
thorimur's user avatar
  • 9,020
7 votes
Accepted

How to "clear" the downvalues of a subscripted variable?

This will remove all DownValues of Subscript that contain the symbol aa: ...
Michael E2's user avatar
  • 238k
7 votes

Apply Clear puzzle

Note that this is happening in your code because by the time Clear gets to the variables, List ({}) has evaluated them and Clear tries to operate on ...
ktm's user avatar
  • 4,242
7 votes
Accepted

Clear a symbol from the kernel

As @bills says, you can just set $HistoryLength=0, but that's rather draconian. Instead, just make sure that Out doesn't store ...
Carl Woll's user avatar
  • 131k
6 votes

Why does removing a function and defining it on the same line not work?

First of all, consider the following two successive inputs: ...
Alexey Popkov's user avatar
6 votes

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

In addition to Rolf's workaround. This is expected and works the same in V9 and V10. NotebookEvaluate / Details & Options: By default, ...
Kuba's user avatar
  • 137k
6 votes

Is it possible to create lookups on temporary symbols that still allow the symbols to be automatically removed?

Here's an example of how you can use ExpressionStore for this: ...
b3m2a1's user avatar
  • 46.9k
6 votes

Clearing ::usage message

It seems one can use the following to force the front-end to update the usage templates (starting in version 12.0): FE`CacheTemplateAndUsage["f"] Please note ...
Lukas Lang's user avatar
  • 34.2k
6 votes
Accepted

How to clear a function with subscript?

Subscript[f, n_][x_] := x f[x - 1] + n; Subscript[f, n][x] Clear[Subscript] Subscript[f, n][x]
cvgmt's user avatar
  • 76.8k
5 votes
Accepted

What is the difference between Clear and ClearAll?

Leonid, I think, was cautioning against using ClearAll[] alone in hopes that this would clear all definitions and provide a "clean slate". The closest ...
MarcoB's user avatar
  • 67.4k
5 votes
Accepted

Different behavior of Clear in different versions of Mathematica

What you're using is a syntax added and well-documented in version 13.2. (Legacy document is here, you can click the UPDATED button to see what's updated. ) In earlier version, you need to control the ...
xzczd's user avatar
  • 67k
5 votes
Accepted

What does this statement about "Block" mean in the official documentation?

You have to read this together with the second bullet point: When you execute a block, values assigned to x, y, … are cleared. When the execution of the block is finished, the original values of ...
Domen's user avatar
  • 27.3k
4 votes

Different strategies to get a clean Kernel. Quit, Exit, ClearAll, Remove, CleanSlate?

The following may not be so useful in packages, but in open notebook evaluation the kernel can be repeatedly quit like so, using a tip from Arnoud Buzing. In this case the orange cells evaluate ...
Chris Degnen's user avatar
4 votes

Clear variables inside Module

I'd like to suggest some changes. First, get away from For loops; use Table instead; secondly, your application of ...
MarcoB's user avatar
  • 67.4k
4 votes

ClearAll["Global`*"] stops working with Context set to 'unique to this Notebook'

I think instead of ClearAll["Global`*"], you can just Clear["`*"]. This should work.
Consideration's user avatar

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