MathGroup Archive 2009

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

Search the Archive

Re: Keep Slider Consistent With a Slow Graph

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100133] Re: [mg100101] Keep Slider Consistent With a Slow Graph
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 26 May 2009 05:07:48 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

You cannot plot without a numeric value for xMax so definition sholud be restricted to numeric input

plotSlowGraph[xMax_?NumericQ] :=
  Module[{x, t},
   Plot[
    NIntegrate[1/((t^2 - 1)*t*Log[t]),
     {t, x, Infinity}],
    {x, 2, xMax}]];

To ensure that they are synched, set option SynchronousUpdating to True

Manipulate[plotSlowGraph[xMax],
 {{xMax, 10, "x Max"}, 10, 400, 10, Appearance -> "Labeled"},
 SynchronousUpdating -> True,
 ContinuousAction -> False,
 SaveDefinitions -> True]


Bob Hanlon

---- bobbaillie at frii.com wrote: 

=============
The graph displayed by the Manipulate below takes a while to display.
While the calculation is taking place, if you click on some other
value on the slider, the slider moves and displays its new value.
However, the graph will plot using the original value.

The result is that the graph and the slider are now out of sync.  This
is bad user interface design.

In the real example I am working with, there is no way to make the
calculations go fast enough to keep up with clicks on the slider.  For
the same reason, I cannot allow the user to slide the slider, so
ContinuousAction must be False.

Nevertheless, is there some way to make sure the slider and the graph
stay consistent with each other?

Robert Baillie

plotSlowGraph[xMax_] :=
Module[
  { x, t },
  Plot[ NIntegrate[1/((t^2 - 1)*t*Log[t]),
       {t, x, Infinity}], {x, 2, xMax} ]
];

Manipulate[
  Graphics[ plotSlowGraph[xMax] ],
  { {xMax, 10, "x Max"}, 10, 400, 10, Appearance -> "Labeled" },
  ContinuousAction -> False, SaveDefinitions->True
]




  • Prev by Date: Re: TRANSFER FILE NAMES
  • Next by Date: Re: list manipulation
  • Previous by thread: Keep Slider Consistent With a Slow Graph
  • Next by thread: Re: Keep Slider Consistent With a Slow Graph