Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: evaluation of a non-visible dynamic[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113227] Re: evaluation of a non-visible dynamic[]
  • From: Michael <michael2718 at gmail.com>
  • Date: Tue, 19 Oct 2010 05:57:16 -0400 (EDT)
  • References: <201010180958.FAA01356@smc.vnet.net>

On 10/18/2010 2:58 AM, John Fultz wrote:
> On Sat, 16 Oct 2010 13:11:16 -0400 (EDT), AlexG wrote:
>> Does anybody know?
>>
>> I like the way dynamic works asynchronously with the rest of my code.
>> The problem is, it only works when the output of the dynamic[]
>> function call is visible on the screen. Is there some way I can
>> programmatically tell dynamic when start and stop updating? If there
>> is, I will be VERY happy!
>>
>> Much Appreciation,
>> --Alex Gurfinkel
>
> Some people have asked for Dynamics that don't require being displayed.
> The problem with this is alluded to by your question...if such a
> thing existed, then you would have to invent some form of lifetime
> management...i.e., ways to start, stop, and kill it.  Otherwise, once
> the Dynamic was evaluated, it would just sit there, soaking up resources
> and potentially evaluating again and again, for as long as the kernel
> is alive.

Along this line, what I think would be very useful is something similar 
to a spreadsheet-like dependency tracking.  I've set up something like a 
spreadsheet, using delayed assignments as formulas and using Table, 
Dynamic and InputField, and it works.  The problem is, if multiple cells 
depend on a single formula it gets recalculated once for each time it is 
used.  For a large spreadsheet this can result in a great deal of 
recursive re-calculation which is not necessary.  (And sometimes 
Mathematica crashes; I think this is an unrelated InputField bug, but I 
gave up on tracking it down...) I wanted to try memoizing the results of 
each cell, but I realized that I don't have any way of knowing when the 
current re-calculation set is over (or about to begin).

In a calculation there is a variable I can look at to tell if a dynamic 
expression is currently being evaluated.  If Mathematica could provide a 
hook that it calls when calculation starts and/or ends that would be a 
way that I could determine when to flush my memoized results.  I would 
imagine the start hook would be called any time user input results in 
new calculations being sent to the kernel, and the end hook would be 
called when the last result is received back from the kernel.

> Sincerely,
>
> John Fultz
> jfultz at wolfram.com
> User Interface Group
> Wolfram Research, Inc.


Best Regards,

Michael


  • Prev by Date: Re: working with lists
  • Next by Date: Re: Mimicking the TI calculator graph "trace" function
  • Previous by thread: Re: evaluation of a non-visible dynamic[]
  • Next by thread: $SyntaxHandler problem