Dynamic Show in Manipulate
- To: mathgroup at smc.vnet.net
- Subject: [mg94041] Dynamic Show in Manipulate
- From: Michael Hsieh <JiaYow at gmail.com>
- Date: Wed, 3 Dec 2008 05:42:08 -0500 (EST)
Hello! I have a seemingly simple problem here, but somehow can't figure out a solution: I compute a Plot of a Differential Equation, with variable x-ranges, and want to show the graphic with a VectorFieldPlot as background. Unfortunately, within Manipulate, the static VectorFieldPlot and the whole Differential Equation are reevaluated anytime I move the slide bar. This makes the whole movie very very slow. Is there a way to "tell" Show that the VectorFieldPlot is just a background and doesn't need to be reevaluated every time? I tried Dynamic Settings, and Background Settings, but nothing really works: Below a code snippet to give you a better idea of what I mean: -- Code (copypaste-able directly into M6 nb) Needs["VectorFieldPlots`"] pl1 = VectorFieldPlot[{1, Cos[x]}, {x, -5, 5}, {y, -5, 5}]; Manipulate[ pl2 = Plot[Cos[x], {x, -5, -5 + k}, PlotRange -> {-5, 5}, PerformanceGoal -> "Speed" ]; Show[pl1, pl2, PlotRange -> {-5, 5} ] , {{k, 1, "k"}, 1, 10}, TrackedSymbols :> {k}] -- End of Code As you can see, this simple example with Cos(x) is already quite slow...when using more graphics options (eg colors) and more complicated functions, the movie just becomes much too slow, especially when considering that the actual effort isn't that big. I even tried to pre-calculate an array of pictures and just print them out in the Manipulate eg Array[[k]], but even this is slow. Does anyone have an idea how to speed this up? Thanks in advance! Regards Michael Hsieh