Message Boards Message Boards

Create a CDF with "File-> -> Preview for Wolfram Player"?

Posted 5 years ago

I am having a difficulty creating a cdf file from my program. Here is my code:

k8 = 2*10^-4*24;
k4 = 2*10^-4*24;
k2 = 4*10^-5*24;
k1 = 2*10^-5*24;

Tmax = 100;

RXN[t_, Reynolds_] := {k8*Reynolds*C8[t], k4*Reynolds*C4[t], 
   k2*Reynolds*C2[t], k1*Reynolds*C1[t]};
STOI = {{-1, 0.45, 0.05,      0,   0.5},
             {  0,    -1, 0.15, 0.02, 0.83},
             {  0,       0,    -1, 0.20, 0.80},
             {  0,       0,       0,    -1,        1}
           };
Y[t_] := {C8[t], C4[t], C2[t], C1[t], Csmall[t]};
init = Y[0] == {3, 0, 0, 0, 0};

f[Reynolds_] := 
 NDSolve[LogicalExpand[
   Y'[t] == Transpose[STOI].RXN[t, Reynolds] && init], {C8, C4, C2, 
   C1, Csmall}, {t, 0, Tmax}]

Manipulate[
 Module[{sol = f[Reynolds]},
  Plot[Evaluate[Y[t] /. sol], {t, 0, Tmax}, ImageSize -> 400, 
   PlotLegends -> {"C8", "C4", "C2", "C1", "<1mm"}, Frame -> True, 
   FrameLabel -> {"Residence Time (d)", "C (g/L)"}]],
 {{Reynolds, 20}, 1, 100}
 ] 

When I run the program in Mathematica 12.0, the code works perfectly and I get this: this is how it look when it works

However, when I go to File -> Preview for Wolfram Player, I get this:

not working :(

Please let me know what is wrong. Thank you very much!!!

POSTED BY: Andrew Marcus
Posted 5 years ago

Use "SaveDefinitions--> { , , , }" in Manipulate ... to save your defined functions and constants

POSTED BY: Tim Mchale
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract