MathGroup Archive 2013

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

Search the Archive

Manipulate and Initialization

  • To: mathgroup at
  • Subject: [mg130224] Manipulate and Initialization
  • From: Fred Simons <f.h.simons at>
  • Date: Sat, 23 Mar 2013 03:24:31 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

I want to create a rather complicated Manipulate, in which I do not know 
the limits for the parameter beforehand; they depend on the result of an 
initialization. Here is a highly simplfied example:

Manipulate[n, {n,1,nn,1}, 

This works fine. The slider can be used in the range from 1 to the 
printed value.

However, when nn already has a value, the behaviour is different. When 
we execute

Manipulate[n, {n,1,nn,1}, 

a value between 5 and 15 for nn is printed, but that value is not used 
in the result; the slider now runs from 1 to 23.

So, whether nn has a value or not, just before the box structure is 
printed, the frontend asks the kernel to evaluate the initialization. 
But the returned value of nn is used in Manipulate only when nn did not 
have a value before. That embarasses me. Any explanation is highly 

Fred Simons
Eindhoven University of Technology

  • Prev by Date: Re: Teleprompter Code
  • Next by Date: Re: RegionPlot and Show
  • Previous by thread: Re: Teleprompter Code
  • Next by thread: Re: Manipulate and Initialization