Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Question about Initialization Cells
Posted:
May 8, 2012 4:07 AM


Evaluate the following in the notebook:
Options[EvaluationNotebook[], CellContext]
If the result is
{CellContext > Notebook}
then that means that the notebook has been set so that any function defined in it is defined in a Context unique to that notebook. If so, then those functions will not be in the context path for Mathematica to find them in another notebook and would need to be called there by their full context path.
David
On May 5, 4:16 am, James Stein <ja...@stein.org> wrote: > I downloaded the source code for a Wolfram Demonstrations Project; this one:http://demonstrations.wolfram.com/ComparingAlgorithmsForTheTravelingS... > > The first three cells, all initialization cells, each contain a simple > oneliner, for example: > dist[p1_, p2_] := Norm[p1  p2] > When I evaluate any of these cells, it appears to define the function, but > when I try (in a second, new notebook window) to evaluate the function > (e.g., to evaluate "dist[4.5]}), the function is undefined. It is blue i > the second window, even though it is black in the first window. > > But If I type "dist[4,5]" in the demonstration project window itself, all > works as expected. > > The demo project does not appear to be a package; 'dist' does not seem to > be private. What am I missing?



