# Works in mathematica but not as cdf preview or web embedded cdf [duplicate]

I have a curvature simulation with the help of m_goldberg that works in mathematica but does not work as a cdf in cdf preview. In mathematica it says nothing while in cdf preview or while web embedded says:

Radius radius[0,1] should be a pair of numbers or a scaled Offset factor...same with coordinate r[0,1] and center[0,1].I've been changing the code for a while with no good results.Please Help Thanks

Clear[t]; forms = {{3 Cos[t], 2 Sin[t]}, {Cos[t], Sin[2 t]}};
lbls = ToString /@ forms;
indxs = Range[Length[forms]];
(r[t_, #] = forms[[#]]) & /@ indxs;
(dr[t_, #] = D[r[t, #], t]) & /@ indxs;
(d2r[t_, #] = D[r[t, #], {t, 2}]) & /@ indxs;
(uT[t_, #] =
Simplify[dr[t, #]/Norm[dr[t, #]], t \[Element] Reals]) & /@ indxs;
(vN[t_, #] =
Simplify[With[{du = D[uT[t, #], t]}, du/Norm[du]],
t \[Element] Reals]) & /@ indxs;
Simplify[
Norm[dr[t, #]]^3/
Abs[dr[t, #][[1]] d2r[t, #][[2]] -
dr[t, #][[2]] d2r[t, #][[1]]], t \[Element] Reals]) & /@
indxs;
(center[t_, #] =
Simplify[r[t, #] + radius[t, #] vN[t, #],
t \[Element] Reals]) & /@ indxs;
Manipulate[
Show[Graphics[{RGBColor[0.6, 0.6, 0.8],

• For starters, add SaveDefinitions->True as option to Manipulate. The problem is that you define your stuff in the global context which is not available inside the Manipulate after you have restarted the Kernel (or open your CDF in the player). May 28, 2014 at 2:48
• As per above comment you need to localize these variables and/or investigate Initialization option to Manipulate May 28, 2014 at 4:37