MathGroup Archive 2001

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

Search the Archive

Re: Problem in loading own Package

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27137] Re: Problem in loading own Package
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 7 Feb 2001 02:12:44 -0500 (EST)
  • References: <95l38f$e2r@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Ossama,
It works OK for me.

The problem may be that that it is not stored in a place where your system
will look (in the directories listed in $Path).
With my Windows system I have put it in the directory

"C:\\Program Files\\Wolfram
Research\\Mathematica\\4.1\\AddOns\\ExtraPackages"

and it loads with

<< Poisson`

If I had put it inside a folder, say, mypacks, in this directory then I
would need to use

<<mypacks`Poisson`

( for other reasons it would then be a good idea to use
BeginPackage["mypacks`Poisson`"])

Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Ossama Kullie" <kullie at hrz.uni-kassel.de> wrote in message
news:95l38f$e2r at smc.vnet.net...
>
>
> 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? .
>
>
>
>




  • Prev by Date: Re: assigning parameters from a matrix
  • Next by Date: Determine the "value range" of a function
  • Previous by thread: Re: Problem in loading own Package
  • Next by thread: Re: Problem in loading own Package