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]];
rules = Thread[Rule[indxs, lbls]];
(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;
(radius[t_, #] =
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],
Disk[center[t, k], radius[t, k]]}],
ParametricPlot[r[t, k], {t, 0, 2 Pi}],
Graphics[{PointSize[.025], Point[r[t, k]]}]], {{k, 1, "function"},
rules, ControlType -> PopupMenu}, {t, 0, 2 \[Pi]}]
SaveDefinitions->True
as option toManipulate
. 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). $\endgroup$Initialization
option toManipulate
$\endgroup$