Re: Interactive .nb works, but converted .nbp fails
- To: mathgroup at smc.vnet.net
- Subject: [mg101727] Re: [mg101694] Interactive .nb works, but converted .nbp fails
- From: John Fultz <jfultz at wolfram.com>
- Date: Wed, 15 Jul 2009 07:11:10 -0400 (EDT)
- Reply-to: jfultz at wolfram.com
This doesn't have anything to do with .nb vs. nbp files, but with version 6 vs. version 7. One of the qualities of any function in the Experimental` context is that Wolfram does not guarantee forward compatibility of such functions. Experimental`ControlBlock was replaced in version 7 with a more flexible notion of what's accepted in Manipulate's control parameter arguments, as well as the new Control[] object, and Experimental`ControlBlock was removed. Here's what your Manipulate would look like in version 7. Manipulate[anima[x, p, x0, p0, A0], OpenerView[{Style["Initial wavepacket width", Bold, 14], Control[{A0, 0.5, 2., Appearance -> "Labeled", ImageSize -> Small}]}], OpenerView[{Style["Initial Conditions", Bold, 14], Column[{Control[{x0, -1, 2, Appearance -> "Labeled", ImageSize -> Small}], Control[{p0, -.5, 2.5, Appearance -> "Labeled", ImageSize -> Small}]}]}], ControlPlacement -> Left, SaveDefinitions -> True] Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc. On Tue, 14 Jul 2009 07:13:58 -0400 (EDT), Porscha Louise McRobbie wrote: > Dear Group, > > I have an animated contour plot inside of a Manipulate command > (below), which seems to work fine inside my .nb file (v.6.0.2.1, Mac > OSX x86). I then copy/paste the interactive part into a new .nb, and > convert it to .nbp (using Wolfram Online Conversion). When the .nbp > file is opened with Mathematica Player 7, I see a pink box and MANY > errors such as Transpose::nmtx, Set::shape, Sort::normal, > First::normal, MapThread::mptd, MapThread::list, etc. > > How is it possible for the .nb to work fine, but the .nbp to have so > many errors? I've converted many other similar animations/interactive > notebooks and opened them inside Player with no problems. > > Does the use of so many delayed assignments in the code cause problems > for the conversion? > > Thanks for any help, > Porscha > ----------------------------------------------------- > > DynamicModule[{w, A0, a, A, dx, xt, pt, Psi, anima, x0, p0, tf,wig, x, > p,t}, > > w = 1; a = w/2; tf = 30; > A[t_, A0_] := > a ((A0 Cos[w t] + I a Sin[w t])/(I A0 Sin[w t] + a Cos[w t])); > xt[t_, x0_, p0_] := x0 Cos[w t] + p0/w Sin[w t]; > pt[t_, x0_, p0_] := p0 Cos[w t] - w x0 Sin[w t]; > wig[x_, p_, x0_, p0_, A0_, t_] := > 1./Pi Exp[-(2 Abs[A[t, A0]]^2 (x - xt[t, x0, p0])^2 + (p - > pt[t, x0, p0])^2 + > 2 Im[A[t, A0]] (x - xt[t, x0, p0]) (p - pt[t, x0, p0]))/ > Re[A[t, A0]]]; > > > anima[x_, p_, x0_, p0_, A0_] := > Animate[ > ContourPlot[wig[x, p, x0, p0, a A0 , t], {x, -4, 4}, {p, -4, 4}, > PlotRange -> {0, .35}, Mesh -> False, ColorFunction -> "Rainbow", > PerformanceGoal -> "Quality"], > > > {{t, .0001, Style["Time", Bold, 14]}, 0.0001, tf}, > AnimationRunning -> False, RefreshRate -> 4, > AnimationRate -> .75]; > > > Manipulate[anima[x, p, x0, p0, A0], > Experimental`ControlBlock[ > Style["Initial wavepacket width", Bold, 14], > {A0, 0.5, 2., Appearance -> "Labeled", ImageSize -> Small}], > > Experimental`ControlBlock[Style["Initial Conditions", Bold, 14], > {x0, -1, 2, Appearance -> "Labeled", > ImageSize -> Small}, {p0, -.5, 2.5, Appearance -> "Labeled", > ImageSize -> Small} ], > > ControlPlacement -> Left, SaveDefinitions -> True]]