Re: Calling functions before loading the package
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg732] Re: [mg684] Calling functions before loading the package
- From: pelle at ic.chalmers.se (Per Ericsson)
- Date: Wed, 12 Apr 1995 08:27:04 +0100
>This is an old problem that keeps coming up for me: > >I want to use a function like "Mean" from the statistics package but I= forget=20 >to load the package first. Now the dummy expression "Mean" obscures all >operations. The only solution I am aware of is to kill the kernel and start= all=20 >over again. There must be a more elegant solution... > >Thanks for the patience, >--- Hi, Below is a run where I first use Mean without having loaded the statistics= package. When I load the package in line 2, Mathematica observes the= multiple definitions. In line 3 I try to use Mean, but Mathematica of= course uses my definition instead of the one in the statistics package. In= line 4 I remove the defenition I made for Mean, and voila, everything works= as it should! Hope it helps, Per Ericsson In[1]:=3D Mean[{1,2,3,4}] Out[1]=3D Mean[{1, 2, 3, 4}] In[2]:=3D <<Statistics`DescriptiveStatistics` =46rom In[2]:=3D Mean::shdw:=20 Warning: Symbol Mean appears in multiple contexts=20 {Statistics`DescriptiveStatistics`, Global`}; definitions in context=20 Statistics`DescriptiveStatistics` may shadow or be shadowed by other definitions. In[3]:=3D Mean[{1,2,3,4}] Out[3]=3D Mean[{1, 2, 3, 4}] In[4]:=3D Remove[Mean] In[5]:=3D ?Mean Mean[list] gives the mean of the entries in list. In[6]:=3D Mean[{1,2,3,4}] Out[6]=3D 5 - 2 /----------------------------------------------------/ / Per Ericsson / / Solid State Electronics / / Chalmers University of Technology / / 412 96 Gothenburg, SWEDEN / / / / pelle at ic.chalmers.se / / Tel. ++46 31-772 18 63 / / Fax. ++46 31-772 36 22 / /----------------------------------------------------/