Tag Info

New answers tagged

7

Your code is redefining the function f every time the Manipulate updates its contents pane, which causing Mathematica to go hyper. You should use the option Initialization so the function is defined just once. Manipulate[ Column @ {Plot[f[x], {x, 0, a}], f[a]}, {a, 1, 50}, Initialization :> (f[x_] = Sin[x])]


2

It seems the definition of f inside the Manipulate is causing the problem (I'm not sure on the exact details, perhaps someone else can elaborate). Besides eldo's solution with TrackedSymbols, you might opt to define f outside: f[x_] := Sin[x] Manipulate[{Plot[f[x], {x, 0, a}], f[a]}, {a, 1, 50}] But why define f at all? It can also be done without ...


4

Manipulate[f[x_] := Sin[x]; {Plot[f[x], {x, 0, a}], f[a]}, {a, 1, 50}, TrackedSymbols :> {a}] solved the problem for me (I got the same flickering). The Documentation doesn't say too much about TrackedSymbols. In your case not only a but also x is continiously updateted. But Manipulate should update x only in case a changes, i.e., the slider is moved. ...


1

To answer the first question: ListAnimate[list] stores the list in the output, while Animate[code,...] stores only the code. Animate does not store the definitions of symbols referenced by code. If code is not self-contained, then the definitions will have to be executed before Animate will run properly. To answer the second question, which is also ...


1

You don't want to pass the full data set into the Manipulate. You just want to pass its name and have it evaluated inside the Manipulate. Try the following. Is it fast enough? SeedRandom[42]; data = RandomReal[{0, 1}, {500, 500, 500}]; SetAttributes[vizData, HoldFirst]; vizData[dataVar_Symbol] := Manipulate[Image[dataVar[[All, All, i]]], {i, 1, 500, 1}] ...



Top 50 recent answers are included