MathGroup Archive 2003

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

Search the Archive

RE: The difference between Needs[ ] & Get[ ]

  • To: mathgroup at
  • Subject: [mg40150] RE: [mg40149] The difference between Needs[ ] & Get[ ]
  • From: "David Park" <djmp at>
  • Date: Sun, 23 Mar 2003 04:12:09 -0500 (EST)
  • Sender: owner-wri-mathgroup at


The reason that ComplexMap1 does not load is that Roman has not set it up as
a package that can load. You can only look at it as a text file to see what
an early version of the package looked like. That is because he has the
Begin statement:


and it should be


to be correct for loading. "ProgrammingInMathematica" gives the folder name
and "ComplexMap1" would give the specific file name.

He intends that you actually use the ComplexMap package. (You could also use

The advantage of the Needs statement over Get is that it can be reevaluated
and if the package is already loaded it will do nothing. Many packages
cannot be loaded a second time without generating error messages. It is
generally more convenient to use Needs. For example, if you open two
different notebooks that both use the same package and both have
initialization cells to load the package, the package will only be loaded

David Park
djmp at

From: neuron [mailto:b90401114 at]
To: mathgroup at

Hello MathGroup gurus,
I am new to Mathematica and now reading "Programming In Mathematica."
I am a little  confused with Needs[ ] & Get[ ].
I kow that  Needs[ ] checks $Packages whether the package is present or
not and I usually use Needs[ ] to load a package.
On the xiv page of "ProgrammingInMathematica" it says "Even better is
but on page 13,
when I input
instead of
an error occurs:
Needs::nocont: Context ProgrammingInMathematica`ComplexMap1` was not
created when Needs was evaluated.

I don't know why, for the Help says "Needs["context`"] calls
Get["context`"]. By convention, the file loaded in this way is the one
which contains a package that defines context`. "

I execute Mathematica 4.1 on Windows98

 Thanks for any advice.

  • Prev by Date: Re: Re: a challenge/problem.
  • Next by Date: Re: The difference between Needs[ ] & Get[ ]
  • Previous by thread: The difference between Needs[ ] & Get[ ]
  • Next by thread: Re: The difference between Needs[ ] & Get[ ]