RE: Re: Loading packages within packages
- To: mathgroup at smc.vnet.net
- Subject: [mg30286] RE: [mg30276] Re: Loading packages within packages
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 5 Aug 2001 16:18:32 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Oliver, I think it is because PDF is not in Statistics`NormalDistribution` itself, but is in Statistics`Common`. So, you should also list that package in your BeginPackage statement. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > From: Oliver Friedrich [mailto:oli.fri at gmx.de] To: mathgroup at smc.vnet.net > > Hallo again, > > thanks for your help, my second question (how to write and save a > package?) > seems to be answered. > But there is still my problem with the unevaluated ExternalFunction A. > My abstract MyPackage package doesn't seem to reflect the error > that I made, > because none of you experts did find anything. So I give a real > example (and > that is almost the thing my packet should do, even the names). > > BeginPackage["TzmSignalTheory`",{"Statistics`NormalDistribution`"}] > > DiscreteGaussExcitement::usage:= > "blabla" > > Begin["`Private`"] > > DiscreteGaussExcitement[f_,width_,var_:w]:= > PDF[NormalDistribution[f,width],var]] > > End[] > > EndPackage[] > > So, that's my pain in the neck. If I call this package in application.nb I > get > > In[1]= > <<TzmSignalTheory` > > In[2]= > DiscreteGaussExcitement[a,b,c] > > Out[2]= > TzmSignalTheory`Private`PDF[NormalDistribution[a,b],c] > > Why doesn't it find the definitions for PDF and NormalDistribution ? They > sure are in this package Statistics`NormalDistribution`, cause it > works when > I load that package in application.nb and work directly with PDF > and Norm... > > My second thought was: OK, can't work if PDF appears in > TzmSignalTheory`context(whatever the reason, it does at all) so my second > approach was > > BeginPackage["TzmSignalTheory`",{"Statistics`NormalDistribution`"}] > > DiscreteGaussExcitement::usage:= > "blabla" > > Begin["`Private`"] > > DiscreteGaussExcitement[f_,width_,var_:w]:= > Statistics`NormalDistribution`PDF[Statistics`NormalDistribution`No > rmalDistri > bution[f,width],var]] > > End[] > > EndPackage[] > > When I load this package (after quit the kernel and reload, I'm really > carefully with that topic), the following happens: > > > In[1]= > <<TzmSignalTheory` > > PDF::"shdw": > "Symbol \!\(\"PDF\"\) appears in multiple contexts \ > \!\({\"Statistics`NormalDistribution`\", \(\"St\" \\[Ellipsis] > \"on`\"\)}\); > \ > definitions in context \!\(\"Statistics`NormalDistribution`\"\) may shadow > or \ > be shadowed by other definitions." > > In[2]= > DiscreteGaussExcitement[a,b,c] > > Out[2]= > PDF[NormalDistribution[a,b],c] > > First that warning after loading the package, but the line Out[2] looks > nicer to me, but still it is unevaluated, Mathematica can't find that > bleeding definitions. > But if I load the Statistics`NormalDistribution`into my application.nb... > > > DiscreteGaussExcitement[a,b,c] > > \!\(E\^\(-\(\((\(-a\) + c)\)\^2\/\(2\ b\^2\)\)\)\/\(b\ \@\(2\ \[Pi]\)\)\) > > Now it comes along with the correct answer. Loading my Statistics into > application.nb could be a workaround, but that's an awful solution. > > By the way: Thanks for the advice with that AutogeneratedPackage > option. But > to me it wasn't easy to find. It isn't documented in the online > help, is it? > > Oliver > >