Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to put together a palette of useful functionality garnered from this site. There is useful stuff scattered all over the place, for example:

As an ugly, yet functional, way of putting them together, I have something like:

    OpenerView[{"Duplicate Active Notebook", duplicating}, True],
    OpenerView[{"Pasting a table", pasting}, True],
    OpenerView[{"Copy for StackExchange", copyForStackExchange}, True]
    (* etc *)
  WindowTitle -> ""];

where the definitions inside each OpenerView are slight modifications of the code from the above links. (Usually just stripping off any existing palette stuff is all that is required. I did find that a single button seemed to require ImageSize -> Automatic so it would display properly.)

So the question is, what else can I add to this?

Are there any procedures you use regularly that are suitable for a palette? Things that have made your mathematica experience easier and more productive?
Is there any enlightening information that could be continually displayed on a palette? E.g. progress bars, memory usage, cursor position?
Are there any tips and hints for beginners that could be nicely presented on a palette?

share|improve this question
This looks a bit like our famous toolbag question on SO/Mathematica. You'll find contributions of many of the top users there. It is closed though, as questions like these and yours not really adhere to the rules for admissible questions. – Sjoerd C. de Vries Aug 23 '12 at 6:36
I like the question (+1) but it must be community wiki. – Mr.Wizard Aug 23 '12 at 12:20
@SjoerdC.deVries Agree ... but we should find a place to collaborate on these. If we can't find another way, I vote for bending the rules somewhat. – Dr. belisarius Aug 23 '12 at 14:22
@belisarius i agree – AimForClarity Feb 23 '13 at 4:59

I used to think that Mathematica was an incorrigible memory hog until I visited this site and discovered the wonders of $HistoryLength. This seems to be a common complaint that is easily remedied. Below is a scattering of buttons that show the current value and allow it to be easily changed:

historyLengthButtons := Grid[{Dynamic[Button[#, $HistoryLength = #, Background -> 
       If[$HistoryLength == #, Yellow, Automatic]]] & /@ {0, 1, 2, 3, Infinity}
 }, Spacings -> 1]



A memory usage graph:

memoryInUse = ConstantArray[MemoryInUse[], 60];
frontEndInUse = ConstantArray[MemoryInUse[$FrontEnd], 60];
      memoryInUse = Append[Rest@memoryInUse, MemoryInUse[]];
      frontEndInUse = Append[Rest@frontEndInUse, MemoryInUse[$FrontEnd]];
, 5];

memoryUsagePlot := Dynamic[Grid[{{Overlay[{
  ListPlot[memoryInUse, PlotRange -> All, Joined -> True, AspectRatio -> 1/5,
    Axes -> False, Background -> Black, PlotStyle -> Green, ImageSize -> Small,
    GridLines -> {12 (Range[6] - 1), None}, GridLinesStyle -> Darker@Gray],
  ListPlot[frontEndInUse, PlotRange -> All, Joined -> True, AspectRatio -> 1/5,
    Axes -> False, Background -> None, PlotStyle -> Red, ImageSize -> Small]
 Style["Kernel", Darker@Green], NumberForm[N[Last[memoryInUse]/10^6], {9, 2}], "MB"},
 Style["Front End", Darker@Red], NumberForm[N[Last[frontEndInUse]/10^6], {9, 2}], "MB"
 }}, Alignment -> {Center, Center}]]

As per Silvia's suggestion, a memory profile:

myByteCount[symbolName_String] := 
  Hold[x__] :> If[MemberQ[Attributes[x], Protected | ReadProtected], 
  Sequence @@ {}, {ByteCount[Through[{OwnValues, DownValues, UpValues, SubValues, 
  DefaultValues, FormatValues, NValues}[Unevaluated@x, Sort -> False]]], symbolName}]];

memoryProfileButton := 
  Button["Memory profile", CreateDocument[
  Style[With[{listing = myByteCount /@ Names[]}, 
  Labeled[Grid[Reverse@Take[Sort[listing], -100], Frame -> True, Alignment -> Left], 
  Column[{Style["ByteCount for symbols without attributes Protected and" <>
  "ReadProtected in all contexts", 16, FontFamily -> "Times"], 
  Style[Row@{"Total: ", Total[listing[[All, 1]]], " bytes for ",
  Length[listing], " symbols"}, Bold]}, Center, 1.5], Top]],
  ShowStringCharacters -> False], WindowSelected -> True, 
  WindowTitle -> "Memory profile"], ImageSize -> Automatic]

Put it all in one section:

  Column[{historyLengthButtons, memoryProfileButton, memoryUsagePlot}]}, True]


share|improve this answer
I found this memory profile function very useful. – Silvia Aug 23 '12 at 6:12
this is amazing, thank you – AimForClarity Feb 23 '13 at 4:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.