MathGroup Archive 2007

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

Search the Archive

Re: Manipulate[] CreateDocument[] BUG ???

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81387] Re: Manipulate[] CreateDocument[] BUG ???
  • From: dh <dh at metrohm.ch>
  • Date: Fri, 21 Sep 2007 03:11:54 -0400 (EDT)
  • References: <fct8vr$pu5$1@smc.vnet.net>


Hi Roby,

Your first examples creates a Notebook as side effect. The Notebook 

takes an argument of Manipulate. Manipulate has the attribute HoldAll. 

Therefore, the variable k will not be replaced by its value before 

beeing deliversed to the Notebook and Manipulate, but will be kept in 

symbolic form. The question is now, what value will k have when the 

enclosing module terminates. I would expect that it will have no value 

atat all. Therefore, what astonishes me is, that it is working under 

specific circumstances.

Well, what can we do about it? We need to make sure that the Manipulate 

gets the value not the variable. This can be done by Evaluate: Replace:

Manipulate[k*s,..] by Manipulate[Evaluate[k*s],..]

and everything will work out.

hope this helps, Daniel



roby.nowak at gmail.com wrote:

> hi everyone, i try to set up two or more Manipulate[] Panels

> originated in seperate notebooks.

> 

> for the creation of the notebooks i use CreateDocument[]

> the code below defines a function A when invoked creates a notebook

> containing one Manipulate[] Panel

> then A is invoked twice such that 2 notebooks are generated.

> but when i try to move the slider s in both Panels the local variable

> k gets somehow corrupted.

> changeing Module to DynamicModule does not help.

> 

> same code works fine if CreateDocument@ ommited, then two Manipulate[]

> are generated and working fine but both inside the current notebook.

> 

> any clues on whats happening ?

> is it a bug or a feature  ?

> 

> (*----------------------------------*)

> 

> (* corrupt example*)

> A := Module[{k},

>    	k = 1;

>    	CreateDocument@Manipulate[

>      		k*s,

>      		{{s, 1}, 1, 10}

>      	]

>    ];

> A

> A

> 

> (*----------------------------------*)

> 

> (* working example *)

> A := Module[{k},

>    	k = 1;

>    	Manipulate[

>      		k*s,

>      		{{s, 1}, 1, 10}

>      	]

>    ];

> A

> A

> 

> (*----------------------------------*)

> 

> 




  • Prev by Date: Re: Solving system of differential integral algebraic equations in Mathematica!
  • Next by Date: Re: Group opener disappearing with Textbook style
  • Previous by thread: Re: Manipulate[] CreateDocument[] BUG ???
  • Next by thread: Re: Manipulate[] CreateDocument[] BUG ???