Re: loading packages
- To: mathgroup at smc.vnet.net
- Subject: [mg42041] Re: [mg41990] loading packages
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Tue, 17 Jun 2003 05:43:21 -0400 (EDT)
- References: <200306160756.DAA17962@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
No, you don't need to kill the kernel. It is enough to Remove the function you inadvertently used before loading the package, e.g.: In[1]:= lpts = Table[{t*Cos[t], t*Sin[t], t}, {t, 0, 4*Pi, Pi/20}]; In[2]:= ScatterPlot3D[lpts]; (here is where you get the error message) In[3]:= Remove[ScatterPlot3D]; In[4]:= Needs["Graphics`Graphics3D`"] In[5]:= ScatterPlot3D[lpts]; Now it plots all right. This has to do with "shadowing". I quote from The Book: "One point to note, however, is that you must not refer to a function that you will read from a package before actually reading in the package. If you do this by mistake, you will have to execute the command Remove["name"] to get rid of the function before you read in the package which defines it. If you do not call Remove, Mathematica will use "your" version of the function, rather than the one from the package." But of course "your" version doesn't exist, does it? Tomas Garza Mexico City ----- Original Message ----- From: "seferiad" <seferiad at pacbell.net> To: mathgroup at smc.vnet.net Subject: [mg42041] [mg41990] loading packages > 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 > >
- References:
- loading packages
- From: "seferiad" <seferiad@pacbell.net>
- loading packages