Re: Problem in loading own Package

*To*: mathgroup at smc.vnet.net*Subject*: [mg27140] Re: Problem in loading own Package*From*: vze295bp at verizon.net (David Reiss)*Date*: Wed, 7 Feb 2001 02:12:46 -0500 (EST)*Organization*: Scientific Arts*References*: <95l38f$e2r@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

In article <95l38f$e2r at smc.vnet.net>, Ossama Kullie <kullie at hrz.uni-kassel.de> wrote: > Dear Mathematica users can you help me? > > I have written the folloing package > > BeginPackage["Poisson`"] > Clear[PoissonBracket] > PoissonBracket::usage = "PoissonBracket[a, b,n] calculates the Piosson > bracket for tow functions a and b which depend on the variables p, q" > Begin["`Private`"] > PoissonBracket[a_, b_, n_] := Block[{pk, n}, > pk = > Simplify[ > Sum[D[a, q[i]]* D[b,p[i]] - D[a,p[i]] * D[b,q[i]], {i,1,n}]]] > End[] > EndPackage[] > > and I have put it in a file Poisson.m, and tried all possibilties to > load the package but it doesnot work! > Mathematica has read the file Poisson.m, but the function PoissonBracket > is not created > As Example : > Needs["Poisson`", "Poisson.m"] > give the folloing error > Needs::nocont: Context Poisson` was not created when Needs was > evaluated. > or: <<Poisson` > then > ?? PoissonBracket > Information::notfound: Symbol PoissonBracket not found. > > or: Get["Poisson.m"] > and then > ?? PoissonBracket > nformation::notfound: Symbol PoissonBracket not found. > > the folloing information may be usfel to anser my quation > $ContextPath > Context[Poisson] > ?? Poisson > > this give the Output > > {"Global`", "System`"} > "Global`" > "Global`Poisson" > the funktion PoissonBracke work very well, when I create it in my > Notebook, only in a package doesnot! > I cannot find any error, why I cannot load the > function PoissonBracket from the pachage? . Where is the file Poisson.m? If you have placed it in your AddOns>Applications directory then Needs["Poisson`" will work (I just verified this on my system). If it is not in that directory then you need to tell Mathematica to look in the relevant directory by either Appending the directory path to the list $Path. --David -- ) Scientific Arts: http://www.scientificarts.com ) Creative Services and Consultation for the Applied ) and Pure Sciences:: David Reiss: dreiss at !SPAMscientificarts.com ) [Remove the !SPAM to send email]