Normally, when using Manipulate[expr, controls, options]
, the graphics updating should be carried out at the very end of expr.
But now I encounter a situation where the graphics result is evaluated at each step inside a double-Fold
-iteration. Yes I can still adopt the method mentioned above and write following code,
DynamicModule[{g},
Manipulate[
Module[{a},
Fold[(
k = #2;
Fold[(a = #2; g = v[a, k]; Pause[.05]) &, {}, Range[5]]
) &, {}, Range[15]];
Dynamic@g
],
{{k, 1}, ControlType -> None},
TrackedSymbols :> {},
SynchronousUpdating -> Automatic,
Initialization :> (v[a_, k_] := Plot[Sin[x (a + k x)], {x, 0, 6}])]
]
But the problem is that I will have to first wait for the double-Fold
-evaluation to complete and only after this can I see the updates in a queued sequence. The code I used here is but an over-simplified example and the actual code will take much longer time for computation. I wonder if it is possible to do the graphics updating at every iteration step when v[a, k]
is evaluated?