Mathematica symbols are the ultimate atoms of symbolic data. Every symbol has a unique name, exists in a certain Mathematica context or namespace, and can have a variety of types of values and attributes.

learn more… | top users | synonyms (2)

55
votes
2answers
3k views

Is there a way to separate variables between multiple notebooks?

I often correct homework by checking the calculations in Mathematica. Sometimes you would like to have two solutions open at once. However often defined symbols such as ...
43
votes
5answers
21k views

How do I clear all user defined symbols?

Is there some way to do this other than going to Evaluation -> Quit kernel and firing a new one up?
39
votes
3answers
2k views

Is there an equivalent of MATLAB's Workspace window in Mathematica?

For example, in MATLAB, a panel is available where one can see straightaway which variables are used and their dimension sizes. Is such a feature available in Mathematica? I really find it hard to ...
39
votes
1answer
1k views

Local variables in Module leak into the Global context

From the Mathematica documentation on Module: Module allows you to set up local variables with names that are local to the module. But after using ...
33
votes
1answer
898 views

What is the story with Removed symbols?

The system function Remove evidently exists primarily to turn a fatal problem into an annoying one, by giving the user a (rather blunt) instrument with which to ...
30
votes
2answers
2k views

How can I use the Klingon alphabet symbols?

Note: This functionality is presently missing. See: How to add named characters to Mathematica 10? Mathematica apparently supports the Klingon alphabet: ...
28
votes
5answers
2k views

How do I reassign canonical ordering of symbols?

I have a big polynomial that evaluates to: $$A^2 e^2 \phi ^- \phi ^++A e \phi ^- \phi ^+ c_{2 w} g_Z+\frac{1}{2} A e g h W^- \phi ^+ +\ll13\gg,$$ which is supposed to represent some terms in the ...
26
votes
5answers
1k views

How do you programatically load data into symbols?

I am trying to convert a list of string names into symbols, which will then be used to store data. I have 24 files (where the name of each file is a member of the list mentioned above) that I need to ...
26
votes
1answer
466 views

Are greek symbols causing different evaluation?

I've updated today to Mathematica 9.0.1.0 from version 8 and found something that absolutely confuses me. Let us define a piecewise function: ...
21
votes
4answers
460 views

Result about Context is inconsistent with the description of “Power Programming with Mathematica”

x = 5; temp`x = 6; Begin["temp`"] {x, Global`x, temp`x} The result in my Mathematica session is {5,5,6}, but it's ...
20
votes
5answers
2k views

How to pass a symbol name to a function with any of the Hold attributes?

Given a function with the attribute HoldFirst, HoldAll or similar, and a variable, list, how ...
18
votes
4answers
1k views

How can I randomly generate a unique, unused symbol?

In a previous question on collecting terms for a multivariable polynomial, I answered with a solution that required a unused symbol to be used for a temporary substitution and back substitution. It ...
18
votes
3answers
549 views

What are the requirements for a well behaved indexed variable? Subscript, ToExpression, Downvalue?

On writing this answer I needed to call a function, (NonlinearModelFit) with an unknown number of parameters. We have learned that we should not use ...
18
votes
3answers
5k views

Guidelines on giving readable names to variables [closed]

I know that one cannot use underscore to a variable name, like degree_of_The_First_Polynomial. But for a long variable name, it ...
18
votes
2answers
239 views

How to find the package file that stores a certain symbol?

Is it possible to figure out in what file a certain packaged symbol lives in (assuming there is no shadowing between multiple identical symbol names)? I would like to have a function that if, given a ...
16
votes
6answers
2k views

How to clear all variables except one?

I have a lot of variables: $a,b,c,d, \ldots $ I want to clear the values of all of them except $b$. It's really lengthy to write Clear[a]; Clear[c]; ... Is ...
16
votes
2answers
698 views

Automated testing for compatibility with older Mathematica versions

I have several packages which I actively develop and maintain. I try to stay up to date with new releases of Mathematica and usually update within a couple of months of a new version coming out. As a ...
15
votes
3answers
287 views

How can I test properties of a symbol from the string name without the symbol completely evaluating

Suppose I have a few symbols, one of which has a value: {abc1, abc2 = 5, abc3}; I can use Names to get the list of names, as ...
15
votes
3answers
561 views

Defining symbol shortcuts in the Front End

I was wondering (because I could not find any documentation on this) if it is possible to do shorthand abbreviations for domains or could one define them? E.g. In[1]:= Element[p,Complexes] Out[...
15
votes
1answer
416 views

Is the sharing of variables in Module/Block within Compile documented behavior?

Today I noticed something, I think for the first time. When used inside Compile variable values within Module (and ...
13
votes
2answers
2k views

Which Mathematica function has the longest name (by character length?)

I came across DamerauLevenshteinDistance[u,v] in the documentation center so that got me thinking: Which documented Mathematica function has the longest name? ...
13
votes
2answers
366 views

Why does leaving and re-entering a context lose values defined in that context?

I'm getting unexpected behavior when beginning a new context, leaving it, and then re-entering it. Specifically, when re-entering the context, symbols that had been previously defined in that context ...
13
votes
2answers
2k views

How to unload automatically loaded packages?

I know that this has been discussed here (How do I clear all user defined symbols?), but my case is somewhat different. How does one unload packages during runtime that were loaded with the start of ...
13
votes
1answer
158 views

All value types for a symbol?

Robby Villegas here shows a nice way to see all the types associated with a symbol. He sets a symbol, valueTypes, to an explicit list of the values types in ...
13
votes
1answer
324 views

Is garbage collection broken in version 10.0.0?

Bug introduced in 10.0.0 and fixed in 10.0.1 In version 10.0.0 under Windows I am observing the following behavior: ...
12
votes
1answer
121 views

How to remove a LocalSymbol (or CloudSymbol)?

In version 10.2 LocalSymbol can be used to create a persistent store of a variable. Once this is created I don't see a method to remove it. How are are they ...
11
votes
1answer
531 views

Get the name of a symbol passed to a function

I'm trying to get the name of a symbol passed to a function with this: f[x_] := {SymbolName[x], x} SetAttributes[f, HoldFirst] x = 5; f[x] But ...
10
votes
2answers
268 views

The introduction for Context in Wagner's book is out of date? [duplicate]

In Section 8.1.1 (P230 of the book, P249 of the PDF) of Wagner's book, the following example is shown: x = 5; temp`x = 6; Begin["temp`"]; {x, Global`x} The ...
10
votes
3answers
830 views

List of Mathematica glyphs

Context I am using Mathematica to create live documents - documents that are both interactive and show mathematical derivations. Now, I'm aware that there are certain symbols that are available via: ...
10
votes
3answers
403 views

How to set a TraditionalForm output for a symbol

How do I set a TraditionalForm output for a particular symbol/function? In particular I would like my user-defined symbol ...
10
votes
2answers
871 views

Telling mathematica to output * instead of space for multiplication, so I can copy as plain text

I am trying to get some symbolic expressions in Mathematica which I would like to paste into my C/MATLAB codes. This can be accomplished nicely by selecting the expression and right-clicking to ...
9
votes
1answer
437 views

How can I replace the Greek symbols in an expression with their plain text names?

Suppose I have an expression with Greek symbols in it. How would I convert that expression to another expression where the Greek symbols have been replaces with their names in plain text? I've ...
9
votes
1answer
4k views

How to create symbol whose name has subscript?

I can do Symbol["foobar"] to create a symbol foobar. How to create a symbol $\theta_1$? ...
8
votes
2answers
624 views

Why Mathematica chooses bracket for function arguments over parenthesis?

This is a non-technical question. I'm just curious that why Mathematica breaks the convention that parenthesis are widely used for function arguments. What's the advantage for ...
8
votes
2answers
529 views

Character to replace _ in symbol names?

In C, _ comes in handy when naming variables and functions, as a replacement for space. For example: ...
8
votes
1answer
176 views

Invalid Symbol Characters

What unicode characters are invalid as a Symbol name? Ideally I'm looking for a complete list. Here is the current list ...
8
votes
1answer
219 views

How to convert formal symbols to standard ones in an expression?

Mathematica generates an expression sometimes using \[Formal] symbols. This is causing a problem with the TeXForm code generated ...
8
votes
1answer
797 views

How to properly DumpSave & Get Global`s symbols inside packages while not touching Global context?

For efficiency reasons I prefer to use DumpSave instead of Save. For ease of access I prefer to save symbols in ...
8
votes
1answer
158 views

Is it possible to write a function immune to symbol redefinitions in any Block surrounding its invocation?

Normally, semantics of symbols used in a function definition can be changed by their redefinitions in Blocks surrounding the function invocation: ...
8
votes
1answer
111 views

What is ExpectationE and what does it do?

I just found the symbol ExpectationE with autocomplete. Rendered the symbol is Searching the documentation and the internet leads to nothing. Does somebody ...
8
votes
1answer
286 views

Defining my own invisible operator

There are some invisible operators in Mathematica (\[ImplicitPlus],\[InvisibleTimes],...
7
votes
1answer
85 views

How to reset the $ModuleNumber?

According to the documentation, we can reset $ModuleNumber to a positive machine integer. There is even an example in the doc: ...
6
votes
1answer
620 views

Using the symbol I for electrical current [duplicate]

I would like to use the I as a symbol for the electrical current. How can I redefine it, so it is not interpreted as the imaginary unity?
6
votes
1answer
582 views

Using external variable as a variable inside WhenEvent & NDSolve

I'm trying to use the new WhenEvent functionality of NDSolve in Mathematica 9, in order to perform an action when a variable in the system reaches a certain value. I would like this variable to come ...
6
votes
2answers
160 views

Naming convention for symbols exported from package

I know this is a little opinion based, but so is Mathematica style guide and similar topics. The issue is important so I think this topic will be beneficial for future visitors. Q: So ...
6
votes
1answer
107 views

Relevant help page for: Sum`?

When I type Sum into Mathematica, it also offers Sum` in the autocomplete dropdown, but when I click the little menu button next ...
6
votes
2answers
242 views

Not FullDefinition for Save. MachineID not Protected?

Is there a way to set what symbols's definitions I do not want to store? Consider the following code: ...
6
votes
2answers
3k views

Generating a vector of dummy variables

So I'm the situation of needing analytical solutions to a family of equations of the form Ax=b, where A is an nxn matrix. I've written a function that does what I want, but I'm currently using a bit ...
6
votes
3answers
110 views

Differentiating between zero and “empty” in lists, and adding them?

(Edit: I mean 'differentiate' as in telling the difference between two things, not as in f'(x) ) I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, ...