RE: loading packages
- To: mathgroup at smc.vnet.net
- Subject: [mg42029] RE: [mg41990] loading packages
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 17 Jun 2003 05:42:53 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Jay, You absolutely have to load the package first! Usually I put an Initialization Section at the top of a notebook and include all the package loading there. I usually also make the cells Initialization cells so they will be automatically loaded. (Don't save as AutoGenerated Package.) It is also generally better to use Needs statements than << statements. They can be reevaluated without causing any problems. (For example you could go back and add a Needs statement for a second package to the same cell and reevaluate, or you may have two notebooks open, which both load the same package.) If you forget to load the package, then you can use a Remove statement to remove the package routine, say ScatterPlot3D, but I generally find it easier to kill the kernel and start over. I think your description of the error message is out of place and would have come after loading the package. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: seferiad [mailto:seferiad at pacbell.net] To: mathgroup at smc.vnet.net If I need to load a specific package, such as, << Graphics`Graphics3D`, I find that this only loads/works properly if this statement preceeds the statement for which it is needed. For example, consider the following three inputs in sequential order. 1: << Graphics`Graphics3D` 2: lpts = Table[{t Cos[t], t Sin[t], t}, {t, 0, 4Pi, Pi/20}]; 3: ScatterPlot3D[lpts]; And the scatter plot is plotted correctly. But now consider the following sequence: 1: lpts = Table[{t Cos[t], t Sin[t], t}, {t, 0, 4Pi, Pi/20}]; 2: ScatterPlot3D[lpts]; Error message is returned because I forgot to load Graphics first.... ScatterPlot3D::"shdw": "Symbol \!\(\"ScatterPlot3D\"\) appears in multiple \ contexts \!\({\"Graphics`Graphics3D`\", \"Global`\"}\); definitions in \ context \!\(\"Graphics`Graphics3D`\"\) may shadow or be shadowed by other \ definitions." 3: << Graphics`Graphics3D` 4: ScatterPlot3D[lpts]; But now it doesn't display the graph. My solution is to quit the Kernal and start over, making sure that I first input the << Graphics`Graphics3D`. Does the Kernal have to be killed like this? Thanks, Jay