MathGroup Archive 2001

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

Search the Archive

Re: Loading packages within packages

  • To: mathgroup at smc.vnet.net
  • Subject: [mg30276] Re: Loading packages within packages
  • From: "Oliver Friedrich" <oli.fri at gmx.de>
  • Date: Sat, 4 Aug 2001 20:02:05 -0400 (EDT)
  • References: <9kdbv0$f4u$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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`NormalDistri
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



  • Prev by Date: Re: confusing Mathematica?
  • Next by Date: Re: Jacobian Elliptical Functions (Integrals)
  • Previous by thread: Re: Loading packages within packages
  • Next by thread: Re: Loading packages within packages