1
$\begingroup$

This question already has an answer here:

I got a package which can be loaded in MMA. The manual for the package does not give demonstrations of all functions/commands. Hoe can i find all the commands in the package?

$\endgroup$

marked as duplicate by Jason B., MarcoB, user9660, Alexey Popkov, Quantum_Oli Apr 27 '16 at 12:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    $\begingroup$ This works for one of the built-in packages: Names["NDSolve`FEM`*"], using the wildcard * character $\endgroup$ – Jason B. Apr 27 '16 at 9:59
  • $\begingroup$ And not only for built-ins, but more generally Names["MyPackage`*"]. Also likely to be useful for an external package: Names["MyPackage`Private`*"] $\endgroup$ – LLlAMnYP Apr 27 '16 at 10:45
  • $\begingroup$ @LLlAMnYP - but then don't you need to load the package in first? I was able to get the list of names for the FEM package without entering Needs["...."] first. But for a package of my own that I have in a special folder (in the $Path) that I use for packages, I had to load it in with Needs before I could get the Names $\endgroup$ – Jason B. Apr 27 '16 at 11:10
  • $\begingroup$ @JasonB Yeah, that's right. I don't think, it's possible without loading it. $\endgroup$ – LLlAMnYP Apr 27 '16 at 11:12
5
$\begingroup$

Once you've loaded the package in with Needs then you can find all the included functions using Names with a wildcard:

Needs["VariationalMethods`"]
Names["VariationalMethods`*"]

(* {"EulerEquations", "FirstIntegral", "FirstIntegrals", 
"NVariationalBound", "VariationalBound", "VariationalD"} *)

or

Needs["PolyhedronOperations`"]
Names["PolyhedronOperations`*"]

(* {"Geodesate", "OpenTruncate", "Stellate", "Truncate"} *)

This works with user-installed packages as well, like MaTeX

Needs["MaTeX`"]
Names["MaTeX`*"]
(* {"BlackFrame", "ClearMaTeXCache", "ConfigureMaTeX", "MaTeX"} *)

You can even use it to see the private function names, here again on a user-defined package, but this one is likely to give a long list, giving any variables that are defined within scoping constructs like Module in the package,

Needs["DivergentColorMaps`"]
Names["DivergentColorMaps`*"]
Names["DivergentColorMaps`Private`*"]
(* {"CoolToWarm", "DivergentColorFunc", "DivergentColorScheme", "DivergentMaps"} *)

(* {"DivergentColorMaps`Private`a", 
"DivergentColorMaps`Private`adjusthue",......
"DivergentColorMaps`Private`rgb2msh", 
"DivergentColorMaps`Private`rgb2xyz", ..........
"DivergentColorMaps`Private`z", "DivergentColorMaps`Private`zi", \
"DivergentColorMaps`Private`z$"} *)
$\endgroup$

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