MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Finding the package that the function comes from

  • To: mathgroup at
  • Subject: [mg93873] Re: Finding the package that the function comes from
  • From: Bill Rowe <readnews at>
  • Date: Thu, 27 Nov 2008 05:33:44 -0500 (EST)

On 11/26/08 at 5:15 AM, tomfabtastic at wrote:

>I am using a number of packages. I can often remember what function
>I want to use, but can't remember what package the function comes

>I know that to list all the functions of PackageX I use: ?PackageX`

>But what if I know the function, but don't know which package it
>comes from ? Is there a command thats allow the function as input
>and then outputs the package name ?

No. But there are a couple of things you might want to consider.

You could put a Needs["package"] or <<package` in your init
file. That would cause the package to be loaded when the kernel
is started. Then the functions would be available without you
needing to recall what package was needed in the future. This
does use memory even when you are doing something that doesn't
require the function.

An alternative would be to put the following in your init file

Declare["package`",{"funcName1", "funcName2", ...]

This will create a stub for the functions. The effect is the
same as using Needs above in that the function is available
whenever you want to use it. But since this is a stub, the
actual package code is not loaded until you actually use the
function. So, the memory footprint is smaller for those sessions
where you do not use the function. And with this approach it is
not necessary to list all of the functions in the package. Only
those functions you like to use need to be listed.

Short of either of the above, it should be possible to create a
function to locate the package containing a given function.
=46indList will search a list of files for a given string. The
packages installed by the standard installation will be in the
directory returned by

ToFileName[{$InstallationDirectory, "AddOns"}, "Packages"]


=46ileNames["*",ToFileName[{$InstallationDirectory, "AddOns"}, "Packages"],=

will return a list of all of packages installed there which can
be searched to locate the desired function.

  • Prev by Date: Re: A problem in Pi digits as Lattice space filling
  • Next by Date: Re: Re: Primed Symbols in Mathematica
  • Previous by thread: Re: Finding the package that the function comes from
  • Next by thread: Global fitting