Re: A simple problem
- To: mathgroup at smc.vnet.net
- Subject: [mg24853] Re: [mg24802] A simple problem
- From: Matt.Johnson at autolivasp.com
- Date: Wed, 16 Aug 2000 03:24:14 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Francisco- look at the documentation for DumpSave. -matt Francisco Gutierrez <rpena at impsat.net.co> on 08/13/2000 01:16:41 AM Subject: [mg24853] [mg24802] A simple problem This is a possibly trivial problem, but it may be relevant for many Mathematica users. Suppose I have a function, I apply it to my data and I tag the result, eg: example= function[data_] I would like to use the tag without having to evaluate the function once and again. Of course, this is possible within each Mathematica session. But I would want to save the notebook, start a new session and then use the tag, without having to run the function again (in my specific case, each time I run it costs more than 2 hours of computer time). Is there a way? Thanks, Francisco Gutierrez ----- Original Message ----- From: David Park <djmp at earthlink.net> To: mathgroup at smc.vnet.net Subject: [mg24853] [mg24802] [mg24733] RE: [mg24673] Package naming > Hi Jack, > > I know that there are different practices, but this is what I like to do. > > I like my packages to behave just like the standard Mathematica packages. > WRI has provided a simple way to do this. > > I put all my packages in AddOns/ExtraPackages and then create folders there > that parallel the ones that are in AddOns/StandardPackages. You can also > create special folders there for special topics. For example, I have a > folder named DifferentialGeometry where I put packages related to that > subject. This way, your packages, or any packages you get from others who > follow this scheme will behave just like standard packages, but will be kept > separate from the standard packages. Mathematica automatically looks in > AddOns/ExtraPackages. > > Suppose that you find that your package would best be grouped with Calculus` > packages. Then create a folder named Calculus in AddOns/ExtraPackages. Place > the notebook that creates the package there. The name of this notebook will > be PiecewiseContinuous.nb. If you have made all the cells initialization > cells, and choosen the Autosave feature, then when you save it, a package > file with the name PiecewiseContinuous.m will also be created there. Anytime > you update the notebook, the package will be updated. > > Here is the slightly tricky part, which is not well documented (as far as I > could find). Write your BeginPackage statement this way: > > BeginPackage["Calculus`PiecewiseContinuous"] > > In other words you have to give the path from ExtraPackages on down. > > Then it should work just like the standard packages. > > David Park > djmp at earthlink.net > http://home.earthlink.net/~djmp/ > > > -----Original Message----- > > From: Jack Goldberg [mailto:jackgold at math.lsa.umich.edu] To: mathgroup at smc.vnet.net > To: mathgroup at smc.vnet.net > > > > Hi once again, > > > > I need some help. > > > > I have just completed designing a package that tries to incorporate > > piecewise continuous functions seamlessly into Mathematica. Naturally, I > > entitle the package PiecewiseContinuous. So, I want the user > > to be able to call this package by > > > > Needs["PiecewiseContinuous`"] > > > > or > > > > <<PiecewiseContinuous` > > > > just the way I can call <<Algebra` or Needs["Collatz`"] to get > > these to Packages to load. (I know the difference between << and Needs; > > I use them both here to illustrate my problem.) > > > > Now the problem ... > > > > What do I put as the argument of BeginPackage[?] and where should the > > package be stored so that the call to load it is not too different from > > <<PieceWiseContinuous` ? I have a feeling these are related questions and > > the answer hinges on ContextPaths. I might > > add that none of the books I have consulted directly address this issue. > > (I have a rather large library of Mathematica books by the way.) > > For instance, > > Maeder gives a host of examples in his book Programming in Mathematica. > > Here is one > > > > BeginPackage["RandomWalk`"] > > ... > > > > EndPackage[] > > > > but does not hint at where and how to store this package so that it can > > be loaded with the call <<RandomWalk` . > > > > My best quess is this: If the user (say me) stores the package in a > > folder `mypackages, then the correct call to load PiecewiseContinuous is > > Needs["mypackages`PiecewiseContinuous`"] since this will tell > > Mathematica where > > to look for this function. Is this right? > > > > Thanks all. Learning Mathematica on my own tends to leave me > > with large gaps in > > my knowledge- or at least in my confidence. > > > > > > Jacl > > > > > > > > > > > > > > > > >