MathGroup Archive 2010

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

Search the Archive

Re: Using package functions in Manipulate/DynamicModule

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109149] Re: Using package functions in Manipulate/DynamicModule
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Mon, 19 Apr 2010 04:11:59 -0400 (EDT)
  • References: <hq0mqd$k0u$1@smc.vnet.net>

Hi,

> So, I decided to try for the cell to just load the package whenever it
> needs to be displayed for the first time.
> "Initialization:>Needs["AddOns'"]" seemed to be perfect. However, it
> doesn't work as expected.
> For example: (SS and IListPlot are from AddOns.m)
> Manipulate[
> IListPlot[SS[p, 100] @@ Range[100]], {p, 1, 100, 1},
>  Initialization -> Needs["AddOns`"], SaveDefinitions -> True]
> doesn't work and tells me there are double definitions in Global` and
> AddOns` of IListPlot and SS (right after starting the kernel)

I think your problem are namespaces and the time when symbols are
created: When the Manipulate is seen, the variables IListPlot and SS
will be created as variables in the Global` context, and only afterwards
the package is loaded, creating the same variables in the
AddOns`-Context. To prevent this there are several ways, one of the most
straightforward would be to use explicitly the full long names of the
symbols, that is (presumably) AddOns`IListPlot and AddOns`SS. There are
several other possibilities, like only creating the symbols when the
body is evaluated with something like:

Symbol["IListPlot"][Symbol["SS"][p, 100] @@ Range[100]]

for your ultimate goal to include everything in one notebook there seem
to be solutions, but I don't know of anything "simple"...

hth,

albert


  • Prev by Date: Re: How to make style sheet with header
  • Next by Date: Two dimensional Splines
  • Previous by thread: Re: Using package functions in Manipulate/DynamicModule
  • Next by thread: Re: Using package functions in Manipulate/DynamicModule