RE: Scope problem
- To: mathgroup at smc.vnet.net
- Subject: [mg35982] RE: [mg35972] Scope problem
- From: "DrBob" <majort at cox-internet.com>
- Date: Sun, 11 Aug 2002 05:13:40 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
Aaron, When I add the line <<Statistics`ContinuousDistributions` directly after your BeginPackage statement, it works properly, but if I add the following line instead, it doesn't: Needs["Statistics`ContinuousDistributions`"] BeginPackage issues a Needs statement anyway (according to Help), but that doesn't seem to be good enough. Apparently you must load the package. I'm new to packages myself, so this totally mystifies me. Bobby -----Original Message----- From: Aaron [mailto:au198295 at hotmail.com] To: mathgroup at smc.vnet.net Subject: [mg35982] [mg35972] Scope problem I have been having difficulty using the distribution packages. In a package I created, I can't get the CDF function to evaluate, and I can't figure out the problem. Below I have included a very simple (and useless) package I created that runs in to the same problem. I want to use the numerical value of the CDF for a normal distribution. When I call TestFunction, this is the output: Global`glibb`Private`CDF[Global`glibb`Private`NormalDistribution[0, 1], -1] Global`glibb`Private`CDF[Global`glibb`Private`NormalDistribution[0., 1.], -1.] Calls to CDF return similar outputs in my useful packages. The package I am currently working with was originally written for Mathematica 2.0, and I am trying to update it to work with 4.0. I was told that all the functions were tested thoroughly in the 2.0 implementation and worked fine. TEST PACKAGE: file "glibb.m" ------------------------------------------------------------ BeginPackage["`glibb`", {"Statistics`ContinuousDistributions`"} ] glibb::usage = "glibb is a test package." TestFunction::usage = "TestFunction[]." Begin["`Private`"] TestFunction[] := Module[{alpha,alpha2}, alpha = CDF[NormalDistribution[0,1], -1]; Print[alpha]; alpha2 = N[CDF[NormalDistribution[0,1],-1]]; Print[alpha2]; ]; End[ ] EndPackage[ ] ------------------------------------------------------------- Thanks In Advance, Aaron