MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: explanation need!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73479] Re: explanation need!
  • From: albert <awnl at arcor.de>
  • Date: Mon, 19 Feb 2007 01:28:42 -0500 (EST)
  • References: <er9co7$d89$1@smc.vnet.net>

Hi,

> In[7]:=
> << "Developer`"

this loads the package Developer`, which normaly does two things:

- load the code defined in the file Developer.m
- put "Developer`" on the context path (this is actually done by the pair of
BeginPackage["Developer`"] and EndPackage[]) which would usualy be part of
the code in Developer.m.

Anyway, Developer` is a special case, since at least in my version the
definition of Developer`ClearCache is available without explicitly loading,
so <<"Developer`" will only put Developer` on the context path and make
available ClearCache without having to use the context explicitly. Without
loading, you can in this special case just as well call
Developer`ClearCache[] directly.

> ClearCache[]

this clears the cache, which I think is there to prevent that you could
eventually get cached results from previous calls to FullSimplify or Solve
which were calculated with RootReduce still active. With a fresh kernel,
you would not need these two lines at all...

> s3 = Block[{RootReduce}, FullSimplify[Solve[1 + x^2 + x^3 == 0]]]

This will now savely "overwrite" RootReduce with a function that does
nothing.
 
> More specifically why is needed to change context first?

this is necessary only so that ClearCache[] is available.

> What does the function ClearCache here in particular?

see above

> Should the following command give a different output?
> 
> In[10]:=
> $Context
> 
> Out[10]=
> "Global`"

no, loading the package (or calling the pair BeginPackage[] and
EndPackage[], to be precise) will only affect $ContextPath, not $Context.
The former is a list of all contexts where mathematica looks for symbols,
the latter defines in which context a new symbol (that is on that was not
found in $ContextPath) will be generated. Evaluating $ContextPath should
show that Developer` is now on that list...

hth,

albert



  • Prev by Date: Re: grouping similar list elements with gaps
  • Next by Date: Re: grouping similar list elements with gaps
  • Previous by thread: Re: explanation need!
  • Next by thread: Re: explanation need!