Tag Info

61

May be this, I have not tried it, but it sounds like this is what you are looking for (if I understood you correctly): Evaluation menu -> Notebook's Default Context -> Unique to This Notebook. So, you do the above for each notebook. I found this in the daily Mathematica tip webpage: http://twitter.com/mathematicatip Update If you want to do it ...

47

Yes, there is. I recommend reading documentation related to Mathematica contexts. In a nutshell, all variables belong to some context (namespace), and all variables can be accessed via their fully-qualified names of the form "ContextNamevarName". If you just use "varName", Mathematica will search contexts in $ContextPath (try evaluating the variable ... 38 An ugly hack, look at all things in Global context, keep in table if Dimensions didn't return {} Grid[Select[{#, Dimensions[ToExpression@#]} & /@ Names["Global*"], #[[2]] != {} &], Alignment -> Left] For this to be helpful it needs to be updated dynamically and preferably be in a palette to avoid scrolling up all the time. Instead of ... 37 Maybe this ? ClearAll["Global*"] 30 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 ... 30 Symbols are created in the current context during parsing. This should not be a problem in normal circumstances as the symbols are merely "initialized" without values or properties. See these posts for more information: Is it possible to use Begin and End inside a Manipulate? Why doesn't this use of Begin[] work? When does Mathematica create a new ... 28 Some observations on Removed Removed is not a normal head, but rather a print form. Consider a definition x := y Once we Remove the y, we invalidate x in a subtle but permanent way - reintroducing the y into the session won't help. Remove is really a rather special-purpose destructuve operation, aimed more at removing auto-generated symbols. In a system ... 25 This behaviour has changed since that book was published. I am writing this additional answer to make it clear how Mathematica 9 searches contexts for symbols and that even the current version 9 documentation is incorrect in describing this. How symbol lookup actually works When you enter a symbol name such as x, Mathematica will check if a symbol with ... 24 An alternative that doesn't require protecting or using private contexts: Clear @@ DeleteCases[Names@"*", "b"]; 23 One solution is to use the third argument of ToExpression: With minimal modification, a working version of your code would look like this: Table[ ToExpression[ mmsignalnames[[i]], InputForm, Function[name, name = Extract[ToExpression[celfilenames[[i]]], mmammindices[[j]]], HoldAll]], {i, Length[mmsignalnames]}, {j, ... 20 So recently I've learned from John Fultz that RawBoxes are kind of verbatim indicator for MakeBoxes which is not well stressed out in documentation. This or I've missed the point but it doesn't matter, here we have handy way to do this: x = 5; ToExpression @ MakeBoxes[RawBoxes["x"] = 123]; x 123 20 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, etc.) have such an argument. This is useful when extracting parts of held expressions. ToExpression acts on strings or boxes, but both the problem with ... 20 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 symbol, causes that symbol to be removed from the system when it's no longer referenced. This is occasionally useful when you need Unique. But whenever you do ...

20

General usage Here is what I think Using strings and subsequently ToString - ToExpression just to generate variable names is pretty much unacceptable, or at the very least should be the last thing you try. I don't know of a single case where this couldn't be replaced with a better solution Using subscripts is also pretty bad and should be avoided, except ...

19

The only reliable way seems to have a good set of unit test suites, and run them in earlier versions of Mathematica (I mention this here since the answer and comments mentioning this were deleted). However, having explicit rules for when functions were introduced and / or last changed, extracted from the docs, seems to me a good thing, which may help reduce ...

19

Max[StringLength@Names["System*"]] 38 Select[ Names["System*"], 38 == StringLength[#] &] {"MultivariateHypergeometricDistribution"} As far as I can say there is no limit for lengths of symbol names, besides that of the memory limitation.

19

This has been discussed on comp.soft-sys.math.mathematica. The gist is that there are lots of Unicode characters you could use, e.g. \[LetterSpace] or \[UnderBracket] (you could consult https://reference.wolfram.com/language/tutorial/LettersAndLetterLikeForms.html for a long list), but I'd strongly urge you not to do that. Once you copy the code out of ...

18

The short answer is don't do it. Really, it's just not a good idea. You can use other symbols, such as \[CapitalIota] which looks almost exactly like I and is entered with EscIEsc. If you're really determined you could substitute symbols using $PreRead and MakeBoxes but again I don't recommend it. For example: MakeBoxes[I, _] := "\[ImaginaryJ]" ... 18 The answer is quite simple. Most people want to multiply numbers without having to use the * symbol, e.g. 3x vs 3*x. So given that this exists in Mathematica, using () for function arguments would introduce ambiguity. Is f(x + y) meant to be f[x + y] or f*(x + y)? This is actually a problem Wolfram|Alpha can face since we try to allow for all forms of ... 17 Shorthand notations: All those shorthand notations are well documented. For double struck letters like$\mathbb{A}$, use EscdsA, where ds stands for "double struck" For script letters like$\mathcal{A}$, use EscscAEsc, where sc stands for — you guessed it — "script". Creating your own aliases: To create your own aliases, use InputAliases. I use it to ... 17 Something like this might be helpful. It replaces the unsorted list of symbols with a sorted list, lets Mathematica rearrange the expression in the normal way, and then applies a HoldForm before replacing the symbols back again. reorderSymbols[expr_, symbols_List] := With[{s = symbols}, HoldForm[Evaluate[expr /. Thread[s -> Sort@s]]] /. Thread[Sort@s ... 17 Below is something posted on Mathgroup by Jason McKenzie Alexander. I made a few tiny changes and corresponded about this with Jason for a short while. He sent me his final version, which I post here with his permission. The original (linked above) is really only a few lines of code and can be studied to grasp the principle. The code below is a full package. ... 16 How about this: list = {1, 2, 3}; ToExpression["list", InputForm, Hold] /. Hold[v_] :> AppendTo[v, 3] {1, 2, 3, 3} list {1, 2, 3, 3} 16 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 ...

16

I found the solution. Mathematica is set up to use the font KLIpIqaDmey. The tip-off is in the UnicodeFontMapping.tr file referenced in the question. The header reads: @@resource UnicodeFontMapping Mathematica: Times Automatic Mathematica: (Times Courier) Automatic Mathematica: (Mathematica1 Mathematica1Mono) Automatic Mathematica: (Mathematica2 ...

15

You can use any built in operator modified with subscripts, superscripts, etc, and retain its precedence, for your own purposes. For example, say you want a general Apply operator like @@ that could work at any level. One could use create the operator @@ with a number subscripted for the level of Apply seems appropriate MakeExpression[RowBox[{fun_, ...

15

You can use String "keys" for indexed variables, as I did for A combination of Set::setraw and Set::shape errors. The strings can have spaces or any other characters you want to use: var["Degree of the First Polynomial"] = (* stuff *); You also have a wide range of characters, many of which can be used in Symbol names. Go to menu Palettes > Special ...

14

Not to detract from the existing answers (particularly @WReach's suggestion, which was the same solution that came to my mind as I read your question, and which I will use here), but you may find it easier to define your own references rather than using strings. (In fact, I wouldn't necessarily recommend an approach based on building Mathematica expressions ...

14

The guide Listing of Named Characters in Mma docs: Mathematica provides systemwide support for a large number of special characters. Each character has a name and a number of shortcut aliases. They are fully supported by the standard Mathematica fonts. For further information about named characters, including character interpretations and naming ...

14

As you said in your comment that you just want a well displayed formula, I suggest using Row to force specific orders. A rough example will look like following, you might want to adjust the priority level according to your needs: expr = A^2 e^2 SuperMinus[\[Phi]] SuperPlus[\[Phi]] + A e SuperMinus[\[Phi]] SuperPlus[\[Phi]] Subscript[c, 2 w] Subscript[g, ...

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