The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Trouble Loading Packages...
Replies: 1   Last Post: Oct 8, 2012 2:51 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Richard Palmer

Posts: 46
Registered: 7/31/06
Trouble Loading Packages...
Posted: Oct 5, 2012 2:41 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

...using the latest version of Mathematica on a 64 bit windows machine.

Here is the relevant code

In[1]:= Directory[]
Out[1]= "C:\\Users\\Richard\\Documents"

{"cellNeighbours.m", "myS.m"}


In[5]:= FindFile["cellNeighbours.m"]
Out[5]= "C:\\Users\\Richard\\Documents\\cellNeighbours.m"
In[6]:= << cellNeighbours`
In[7]:= ?cellNeighbours
During evaluation of In[7]:= Information::notfound: Symbol cellNeighbours
not found. >>

Needs::nocont: Context cellNeighbours` was not created when Needs was
evaluated. >>

Same thing happens with the myS package. Why can't if find and load the


This is the cellNeighbours Package


cellNeighbours::usage =
"cellNeighbours[r,c] sets up a function to quickly return a list of the n
nearest neighbours of a given cell in an r\[ScriptX]c matrix. By deafult, a
toroidal distance matrix is assumed.";
neighbourhoodList::usage =
"neighbourhoodList[rI,cI,k] returns a list of the k nearest cells to \
\!\(\*SubscriptBox[\(cell\), \(r1, c1\)]\) in an r\[ScriptX]c matrix. By \
deafult, a toroidal distance matrix is assumed";

toroidalDistance::usage =
"teroidalDistance[{r1,c1},{r2.c2}] returns a \!\(\*
StyleBox[\" \",\nFontSlant->\"Italic\"]\)\!\(\*
StyleBox[\" \",\nFontSlant->\"Italic\"]\)distance between two points";

distancefn::usage = "distance[a,b,len] computes a \!\(\*
StyleBox[\" \",\nFontSlant->\"Italic\"]\)\!\(\*
StyleBox[\"around\",\nFontSlant->\"Italic\"]\) distance from a to b
between \
two cells on the same row or column. \!\(\*
StyleBox[\"len\",\nFontSlant->\"Italic\"]\) is the length of the \

rows = -1;
cols = -1;
cellNeighbourhood = -1;
cellIndices = -1;
cellNeighbours[r_Integer, c_Integer] := Module[{},
rows = r;
cols = c;
cellIndices = Table[{i, j}, {i, 1, r}, {j, 1, c}];
cellNeighbourhood = Nearest[Flatten[cellIndices, 1]
DistanceFunction -> toroidalDistance]] /; r > 1 && c > 1;
distancefn =
Compile[{{a, _Integer}, {b, _Integer}, {len, _Integer}},
Module[{mn, mx, result},
If[a == b, Return[0]];
mx = Max[a, b];
mn = Min[a, b];
result = Min[mx - mn, mn + len - mx];
If[result < 0, Print[{"distance error", a, b, len, result}]];
toroidalDistance[p1_, p2_] :=
Module[{r, c}, r = distancefn[First[p1], First[p2], rows];
c = distancefn[Last[p1], Last[p2], cols]; r^2 + c^2];
neighbourhoodList[r_, c_, n_] :=
cellNeighbourhood[{r, c}, n];

Richard Palmer

Home 941 412 8828
Cell 508 982-7266

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.