# Tag Info

36

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 ... 31 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 ... 27 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 ... 20 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 ... 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 ... 18 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 ...

17

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]" ... 16 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? You raise good questions in the ... 13 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 ... 13 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 ... 12 If you look at the generated code (CompilePrint, for example), the procedure is as follows: All the program's constants are placed into separate registers (regardless of their location in the program, they can be in the r.h.s.of variable initialization in scoping constructs, or they can be statements in their bodies. Actually, same constants found in ... 11 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 ... 11 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, ... 11 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 ... 11 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. ... 11 You are missing Unevaluated: SetAttributes[f, HoldFirst] f[x_] := {SymbolName[Unevaluated@x], x} because SymbolName does not hold its arguments, so you have to prevent evaluation also there. Generally, if you are passing some argument via a chain of function calls, and want to keep it unevaluated, you have to prevent it's evaluation at each stage ... 10 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 ... 10 If you want to revert the entire system to some state, then CleanSlate may be the best option. If you want to unload a few specific packages though, you can use my package PackageManipulations, available here. It has a function PackageRemove, which does exactly that. It has an accompanying notebook with explanations. Some additional notes on it are in this ... 9 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 ... 9 Unique[] is the function that does exactly what you want. However, do note that Unique uses$ModuleNumber and increments it, so if your code depends on the value of $ModuleNumber or if you mess with it, you should be aware of the consequences. 9 Use OverDot ref/OverDot in the documentation (but one of those cases where you need to know what you want in order to be able to enter it) OverDot[Q] 9 I found the solution. Mathematica is set up to use this font. 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 Mathematica2Mono) ... 9 Here is the formatting command that does this: pvB /: MakeBoxes[pvB[n1_, n2_, x_, s_, m0_, m1_], TraditionalForm] := RowBox[{SubscriptBox["B", RowBox[{Sequence @@ Riffle[Table["0", {n1}], "\[ThinSpace]"], "\[ThinSpace]", Sequence @@ Riffle[Table["1", {n2 - n1}], "\[ThinSpace]"]}]], "(", Sequence @@ Riffle[Map[ToBoxes, {x, s, m0, ... 8 I have the following commands in my init.m file, which can be found in$UserBaseDirectory/Kernel/init.m. eraseAll := ClearAll[Evaluate[$Context<>"*"]]; eraseAll::usage="eraseAll clears all values, definitions, attributes, messages and defaults associated with symbols in the current context" removeAll := Remove[Evaluate[$Context<>"*"]]; ...

8

In addition to Mike's post two things you can do: Type "Q" then press Ctrl+& and then type "." to enter with a shortcut. Use palette - there are actually a few you can use. For example go menu Palette >> Other >> Basic Math Input . This will bring a neat concise palette of frequently used input forms. Bottom left corner has what you need. Little, ...

8

The error is in your differentiation line: FOC = D[f[qu_, quu_, qud_, \[Psi]_], quu] Change this to FOC = D[f[qu, quu, qud, \[Psi]], quu] and you'll get a meaningful answer. The reason for this behavior is that x_ is a pattern that matches anything, and this anything can then be referred to by using x. You can read your function definition, f[qu_, ...

8

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, ...

8

The * multiplication operator is rendered in InputForm: c = a*b; c // InputForm a*b For producing/exporting strings: ExportString[c, "Text"] ToString[c, InputForm] "a*b" "a*b"

7

You need to make the left-hand side of Set a symbol at the time of evaluation. Use With or similar to inject the symbol: mmsignalnames = {"one", "two", "three"}; With[{lhs = ToExpression[mmsignalnames[[2]]]}, lhs = 5 ]; two 5 Another approach that could be important if you are trying to make assignments to symbols that already have values is this: ...

7

Here is a way to see what is new or changed relative to an older version. Assuming English documentation, newSince[oldversion_] := Module[{new}, new[version_] := StringReplace[Cases[ Import[FileNameJoin[{\$InstallationDirectory, "Documentation", "English", "System", "Guides", "NewIn" <> ToString@version <> ...

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