1
$\begingroup$

I am trying to deploy a very simple animation on the cloud, but it does not show up.

This is the deployment with the full code

Does anybody know why this may be?

For context, the Mathematica file has simply two lines (exactly as in the link above):

sol[t_]=theta[t]/.DSolve[{theta''[t]==-Sin[theta[t]], theta[0]==-1, theta'[0]==0.1}, theta,t][[1]];
Animate[Show[ListPlot[Re[{{Sin[sol[t]],-Cos[sol[t]]}}],PlotStyle->PointSize[0.02],PlotRange->{{-2,2},{-2,2}},AspectRatio->1],Graphics[Line[{{0,0},{Sin[sol[t]],-Cos[sol[t]]}}]]],{t,0,10}]

To deploy to the cloud I clicked File: Publish to cloud.

$\endgroup$
7
  • $\begingroup$ The code works fine on my laptop. How did you deploy it to the cloud? $\endgroup$ Jul 5, 2021 at 17:38
  • $\begingroup$ Initially, I see a pink output, then it goes away after 2 seconds. This means it found an issue. On the PC, there is no initial pink output and it works OK. This means the cloud is having problem with it for some reason. You can report this to WRI. $\endgroup$
    – Nasser
    Jul 5, 2021 at 17:40
  • $\begingroup$ @DavidG.Stork yep, the code itself is fine on my laptop. I just did File: Publish to cloud and used the default settings. $\endgroup$ Jul 5, 2021 at 17:53
  • $\begingroup$ Please show your cloud deployment code, as that is surely the source of your problem. $\endgroup$ Jul 5, 2021 at 17:54
  • 1
    $\begingroup$ I suspect you need to initialize sol. Have a look at the Initialization option of Animate, or simply use With as follows: With[{sol=DSolveValue[{theta''[t]==-Sin[theta[t]],theta[0]==-1,theta'[0]==0.1},theta,t]},Animate[...]] $\endgroup$ Jul 5, 2021 at 18:55

1 Answer 1

1
$\begingroup$

This was answered for me on the Wolfram community, though @GeorgeVarnavides suggestion of using With also worked.

The answer is to use SaveDefinitions->True within Animate:

sol[t_]=theta[t]/.DSolve[{theta''[t]==-Sin[theta[t]], theta[0]==-1, theta'[0]==0.1}, theta,t][[1]];
Animate[Show[ListPlot[Re[{{Sin[sol[t]],-Cos[sol[t]]}}],PlotStyle->PointSize[0.02],PlotRange->{{-2,2},{-2,2}},AspectRatio->1],Graphics[Line[{{0,0},{Sin[sol[t]],-Cos[sol[t]]}}]]],{t,0,10},SaveDefinitions->True]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.