Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
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.
4
votes
Accepted
Special characters in mathematica
Use Text in Graphics. This page, and the ones linked under Tutorial (top right corner) explain how to type math.
Here's one way, keystroke by keystroke:
", a, ", ←, shift+←, control+shift+T, ←, con …
6
votes
Accepted
Shared variable can not be distributed again after UnsetShared
In[2]:= ParallelDo[Print[a], {4}]
(kernel 4) 1
(kernel 3) 1
(kernel 2) 1
(kernel 1) 1
a is now recorded in the list of distributed symbols. … In[3]:= Parallel`Developer`$DistributedDefinitions
Out[3]= {Hold[a]}
Setting a as shared removes it from the list of distributed symbols to prevent bad interactions between the sharing and distribution …
21
votes
Accepted
How can I randomly generate a unique, unused symbol?
Unique will do precisely this. Try for example Unique[x], which returns a symbol with a name similar to x$123.
Here I should mention the Temporary attribute as well, which, when associated with a sy …
7
votes
Accepted
Should I Protect function's options
BeginPackage["Foo`"];
Unprotect["Foo`*"];
(* list all symbols meant for export,
including any symbols used as options only *)
Begin["`Private`"];
(* package code *)
With[{syms = Names["Foo`*"]} …
1
vote
Accepted
How can I clear the symbol \[ImaginaryJ] for use for another purpose?
You cannot clear it, because \[ImaginaryJ] does not have a definition. \[ImaginaryJ] does not transform to I through the normal evaluation procedure. Instead, it is directly parsed as the imaginary un …
6
votes
Accepted
Symbol scope in `SetDelayed` and `Evaluate`
Don't think about these things in terms of "scope", as that will lead to confusion. Mathematica does not (usually) use "scope" in the way you may be familiar with from other languages. In particular, …
10
votes
Why does leaving and re-entering a context lose values defined in that context?
Please read here first on how Mathematica searches contexts for symbols.
In short,
$Context tells it where to create symbols. It's for creation, not for lookup. … $ContextPath tells it where to look for symbols but doesn't affect symbol creation.
If the symbol is not found in any of the $ContextPath contexts, Mathematica proceeds to create it in $Context. …
6
votes
Getting new symbols into Mathematica
You already have a palette for a great variety of symbols used in math. Just go to Palettes -> Special Symbols. The palette contains the $\mathfrak{A}$ symbol as well. …
7
votes
Accepted
ToString get local name of the symbol
foo`bar
(* foo`bar *)
ToString[foo`bar]
(* "foo`bar" *)
SymbolName[foo`bar]
(* "bar" *)
Warning:
Converting between symbols and strings requires great care, especially when different contexts are … Robust code will not normally convert between strings and symbols. …
3
votes
Accepted
Unexpected behavior of NotebookDirectory
The reason why the subsequent evaluation of the second code block doesn't trigger the warning is that it doesn't create any new symbols. Both A`n and B`n have already been created. … If you are writing a package, you should only place those symbols into the package context which are meant to be directly used by the package's users. Above, n is not such a symbol. …
13
votes
Accepted
Why does args symbol exist in a fresh kernel?
In this case, I chose to include a few extra checks, as well as unprotect/protect symbols. Notice, however, that only System` context symbols appear in this file. … A simple way is
With[{symbols = Names["MyPack`*"]},
SetAttributes[symbols, {Protected, ReadProtected}]
]
However, this would create Global`symbols. …
4
votes
Accepted
Position doesn't work for custom symbol within package
If you literally have
FindSym[x_] := Position[x, mySym]
in your package, then this mySym is probably created in PA`Private` (depending on your package setup). PA`Private`mySym is distinct from Glob …
8
votes
Accepted
Naming convention for symbols exported from package
Like Leonid, I also prefer capitalized public package symbols. … accidental conflicts with built-in symbols or package symbols. …
24
votes
Accepted
How can I test properties of a symbol from the string name without the symbol completely eva...
I usually use
ToExpression["symbol", InputForm, ValueQ]
ToExpression will wrap the result in its 3rd argument before evaluating it.
Generally, all functions that extract parts (Extract, Level, …
7
votes
Accepted
Using packages with symbols that have the same name
This is not the case if there's a conflict with System` symbols, as that context is still active and visible to package B during load time. …