Using Mathematica » Interface

Documentation

Getting Documentation

Mathematica has a rich, if somewhat overly complex documentation system. To learn about a given symbol there are a few things you can do. Probably the quickest is to use the built in function Definition which prints out the description all the definitions on a symbol. You can do this by putting ? before a symbol

 ?Print
Print[expr] prints expr as output.
 ?Plot
Plot[f,{x,Subscript[x, min],Subscript[x, max]}] generates a plot of f as a function of x from Subscript[x, min] to Subscript[x, max]. Plot[{Subscript[f, 1],Subscript[f, 2],},{x,Subscript[x, min],Subscript[x, max]}] plots several functions Subscript[f, i]. Plot[{,w[Subscript[f, i]],},] plots Subscript[f, i] with features defined by the symbolic wrapper w.Plot[,{x}∈reg] takes the variable x to be in the geometric region reg.
 ?Quantity
Quantity[magnitude,unit] represents a quantity with size magnitude and unit specified by unit.Quantity[unit] assumes the magnitude of the specified unit to be 1.
 ?GeneralUtilities`PrintDefinitions
PrintDefinitions[symbol] creates a window containing a browseable hyperlinked listing of definitions associated with symbol.

To find out the most about a symbol it's best to use the built in documentation notebooks however. Just type a symbol name and click the 122documentation-5159485901130549445 icon in the little menu that appears. This will open the Documentation Center where you can look around, find links to other functions and symbols, explanations, and most crucially examples.

This menu can also be gotten by placing the cursor immediately following a symbol name or piece of one and pressing CMD+K

Another way to open the documentation center is to highlight a piece of text and press CMD+SHIFT+F. This is often more useful, as getting the icon to appear can be annoying and this also works in any environment.

Documentation Issues

Mathematica has no automatic documentation procedure. It's all done manually. This allows for commonly used function to be incredibly well documented, but also means that less used functions get somewhat short shrift and many aren't documented at all (although this is often intentional, as a feature isn't ready for prime-time)

Another common problem is that Mathematica's built in autocomplete features only match from the beginning of the word you're typing. Say you know there should be a function that converts a number into a string, so you start typing something like NumberToString , but as you're typing you notice Mathematica will give you NumberString , but when you check its documentation page its not what you wanted at all. For that, I provide the following helpful function using the built in function Names :

 FindMySymbol[piecesOfAName__String]:=
  Riffle[
    ConstantArray[
      Alternatives[piecesOfAName],
      Length@{piecesOfAName}
      ],
    ___
    ]//
      Append[#,___]&//
      Prepend[#,___]&//
      StringExpression@@#&//
      Names

And we'll see that this works:

 FindMySymbol["String","To"]
 {"ByteArrayToString","StringToByteArray","StringToStream","ToString"}

Notice it won't find anything if we use all parts of our name:

 FindMySymbol["String","To","Number"]
 {}

But that's okay. Just add or drop pieces as necessary. Or use the following and just provide a guess of your name:

 GuessedSymbols[nameGuess_String, matchComponents_:2]:=
  With[{nameSegments=
    SequenceCases[
      StringSplit[nameGuess,
        l_?UpperCaseQ:>l],
      s:{_?UpperCaseQ,_?(LowerCaseQ@StringTake[#,1]&)}:>StringJoin@s
      ]},
    FindMySymbol[Sequence@@#,False]&/@
      Subsets[nameSegments,{matchComponents}]//
        Join@@#&//DeleteDuplicates
    ];
GuessedSymbols[name_Symbol,matchComponents_:2]:=
  GuessedSymbols[ToString@name,matchComponents]

To verify it works:

 GuessedSymbols@"StringToNumber"
 {"ByteArrayToString","StringToByteArray","StringToStream","ToString","NumberFieldClassNumber","NumberString","ToNumberField"}

See Also: