Re: Trouble with Module in a package
- To: mathgroup at smc.vnet.net
- Subject: [mg68405] Re: Trouble with Module in a package
- From: gardyloo <gardyloo at mail.wsu.edu>
- Date: Thu, 3 Aug 2006 06:07:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
gardyloo wrote: > Hi, all, > > I'm having a problem with one of my functions as defined in a package > I've written. I'll try to create a simple example to post -- the package > is tied into several others for the moment. For now I'm hoping that > someone can recognize the symptoms and give me some hints. > > The main problem is this: the function (which is a module) doesn't > work when called directly from the package (which was developed on v. > 5.1 on Windows, but misbehaves both in Windows and in v. 5.2 in linux). > HOWEVER, the function works great when I evaluate the function > definition in the package notebook, and then evaluate it. > > In particular (I know that posting this without the explicit code > might be futile, but I might as well try): > > If I evaluate the function's definition (which is a Module), I > might get > > In[14]:= RingDown[dataset, showPlot->False] > > Out[14]= {\[Gamma] -> -2839., ringDownFunction -> 0.73716 / E^{2838.997*(-0.00229 + t)), centerFrequency$423 -> 59365.724, Q -> 131.386} > > > The above is the expected and correct output. > > BUT if I start a fresh kernel and load the package using > Needs["whatever`whatever`"], then the function might give me > > Out[14]= {\[Gamma] -> -2839., ringDownFunction -> 0.73716 / E^{2838.997*(-0.00229 + t)), centerFrequency$328 -> {0.002239928, -0.76763}, Q -> {4.95734*^-6, -0.0016989}} > > I have no idea where those numbers in the returned lists for > centerFrequency and Q come from (I'm still trying to figure that out). > But what really astounds me is that the package's definition evaluates > differently from evaluating the function directly in the notebook (the > former returns a list for some parameters; the latter returns single > numbers). I've been very careful to load exactly the same packages for > each test, and the results are always the same. > > Any hints? > > Thanks, > Curtis O. > > Ah, yes. Through a tedious and wrenching regime of walking around a lot and grimacing at nothing very much, I've determined that I didn't load a required package in the BeginPackage[] portion of my new package. I still don't know where those lists came from in the output, but since things now work, I don't care. Thanks for putting up with my premature question. -- ========================================================== Curtis Osterhoudt gardyloo at mail.remove_this.wsu.and_this.edu PGP Key ID: 0x088E6D7A Please avoid sending me Word or PowerPoint attachments See http://www.gnu.org/philosophy/no-word-attachments.html ==========================================================