Re: Interactive .nb works, but converted .nbp fails
- To: mathgroup at smc.vnet.net
- Subject: [mg101726] Re: Interactive .nb works, but converted .nbp fails
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Wed, 15 Jul 2009 07:10:59 -0400 (EDT)
- References: <h3hoc1$4mc$1@smc.vnet.net>
The code you posted doesn't work in Mathematica as it is. Only after removing the ControlBlock stuff does it run OK. In that case, the nbp-converted file runs OK as well. Cheers -- Sjoerd On Jul 14, 12:58 pm, Porscha Louise McRobbie <pmcro... at umich.edu> 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 -> "Rainbo= w", > 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]]