Questions tagged [clear]

Clearing symbol values, removing symbols from memory and general garbage collection.

Clearing symbol values, removing symbols from memory and general garbage collection.

68 questions
13
votes
2 answers

How to clear everything in Mathematica?

I am a new user. According to a documentation, Clear["context`*"] clears all symbols in a particular context. I want to clear everything (functions, variables, etc..) After I use the above command, my function n1[x,y] is still defined. Thanks
Mikhail Genkin
  • 607
  • 1
  • 4
  • 11
10
votes
1 answer

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

To solve some PDE, I have to set NumericQ[n]=True on some symbol to get a solution, else Mathematica will not solve it. When I tried ClearAll[n] later on, above command effect was not removed. I need to clear it, so that later commands do not fail,…
Nasser
  • 143,286
  • 11
  • 154
  • 359
10
votes
2 answers

How to clear just variables defined in one notebook?

I'm trying to set up some notebooks so that I have one "seed" notebook that defines all my values globally when I run it. I have three other notebooks that take these values and run with them to do what they do. Problem is, these notebooks solve…
SixtySuit
  • 163
  • 1
  • 6
5
votes
1 answer

Clear a symbol from the kernel

I have a code that works over lists like S0; (*initial list*) S1=f[S0]; S2=g[S1]; S3=f[S2]; S4=f[S3]; . . . where f and g are functions that produces larger lists that consume a large amount of RAM memory. I thought that running S0; (*initial…
Filburt
  • 578
  • 5
  • 13
4
votes
2 answers

How do I clear all variables with subscripts?

Possible Duplicate: Clear complains that a variable is not a symbol or a string? Clear["Global*"]` Works for most variables, however if i do something like $ \delta_a = \alpha_a \Delta T d $ Then the Clear or ClearAll will not clear $ \delta_a $,…
user160917
  • 151
  • 1
  • 6
3
votes
1 answer

How to Clear derivative definitions?

I can't find a Clear or ClearAll command that gets rid of Derivative definitions I created. this code: ClearAll["Global`*"]; gau[x_, v_] = (1/Sqrt[2*Pi*v])*E^-((x^2)/(2*v)); Derivative[0, n_][p][x, v] := Simplify[D[gau[z, v], {v,…
Jerry Guern
  • 4,602
  • 18
  • 47
3
votes
1 answer

How does one clear the value of a subs variable?

I saw the topics here, but it's not clear at all how to clear variables with sub. Ideas? Btw, does anybody know why Mathematica won't give me the numerical value of the 4-th zeta function derivative at 0? It displays it symbolically, but not…
user81908
  • 31
  • 2
1
vote
1 answer

How to be sure I've cleaned up all prior definitions and assignments

Is there any general way besides restarting the kernel to make sure that nothing I've done earlier in a session will affect code I want to run now? One book suggested running Clear["Global'*"] but this did not protect me from the problem…
Paul
  • 11
  • 1
1
vote
1 answer

Do I need to clear all definitions whenever I experiment with new parameter values?

Do I have to clear all my definitions whenever I experiment with different parameter values for my model? For example, I have a simple model as follows: w[t_]:=w[t]=w[t-1]+h w[0]=0 h = 5 I want to do: Table[w[t], {t, 0, 10}] with varying h.…
ppp
  • 817
  • 8
  • 15
1
vote
1 answer

How to Unprotect and Clear the E constant?

By default, E is used to represent the Euler's number in Mathematica. I need the variable E to behave just like other undefined variables in my code. When I run the commands Unprotect[E] Clear[E] the variable E remains black, which means it still…
1
vote
0 answers

How to clear all subscripted variables?

I have the following variable: Subscript[n, 0 ] = 12 (\[Sigma] L^2)/(e h^2) If I now do: ClearAll["Global`*"] And then call: Subscript[n, 0 ] I get: 12 (\[Sigma] L^2)/(e h^2) ... So apparently a variable with a subscript cannot be deleted by…
james
  • 3,043
  • 13
  • 29
1
vote
0 answers

Is ClearAttributes built-in functon work in current cell only?

I have a question. Is ClearAttributes the built-in functon work in current cell only? This is my code: In first cell: Set[a, 6] In second cell: ClearAttributes[Set, HoldFirst] Attributes[Set] Set[a, 7] As you can see in the second cell there is no…
SIJA
  • 89
  • 5
0
votes
1 answer

All definitions are cleared when I reopen my file

I just started getting into mathematica and have the problem that whenever I save and reopen my .nb file, all functions and variables are cleared and I need to shift+enter every cell again to continue working on it. Is this normal, suggested to be…
0
votes
0 answers

Calling Clear within a function

I want to create a function that when it is called clears the value of a parameter. For example I want to keep the value of a parameter and then clear its valueby calling a function: a = 1; f[x_] := {b = x; Clear[x]} f[a] However calling f[a]…
Nitra
  • 347
  • 1
  • 8