0
|
6292 Views
|
|
1 Total Likes
View groups...
Share
GROUPS:

# Manipulate and cascades in a transmission line

Posted 11 years ago
 So I wrote a code that plots the probability distribution function for a number of cascades in a transmission line given initial propagation and distrubance. Initialization is as follows: SetOptions[EvaluationNotebook[], NotebookDynamicExpression :> Refresh[         \[Lambda] = .1;     BTD[r_,        x_, \[Lambda]_] := (x*\[Lambda] (r \[Lambda] )^(r - x -             1)) (E^(-r*\[Lambda] )/(r - x)!);   (*Where r is the total number of failure, \[FormalZ] is the \initial number of failure,  \[Lambda] is the mean propogation*)   BTDdist[x_, \[Lambda]_, n_] :=     Table[BTD[r, x, \[Lambda]], {r, 1, n}] // N;   BTDdistdrop[x_, \[Lambda]_, n_] :=     Drop[Table[BTD[r, x, \[Lambda]], {r, 1, n}], 1] // N;   BTDdistcond[x_, \[Lambda]_, n_] :=     BTDdistdrop[x, \[Lambda], n]/(1 - E^(-x));   nextstage[thisstage_, \[Lambda]_] :=     RandomInteger[PoissonDistribution[thisstage \[Lambda]]];, None]]But the part where i am having problem is as follows Manipulate[   Column@{Text["Propagation= "] , Text[\[Lambda]],      Labeled[Framed[       ListLogLogPlot[BTDdistcond[z, \[Lambda], 2000], Joined -> True,         AxesLabel -> {Failures , Probability}, ImageSize -> Medium,       PlotRange -> {All, {0.000001`, 1}}]], PDF, Top],    ControlActive[\[Lambda],     Monitor[For[i = 1, i <= 2, Pause[.3]; i++],      Labeled[NestWhileList[nextstage[#, \[Lambda]] &, 1, # != 0 &],       Cascades, Top]]]}, {{\[Lambda], .01, "Propagation"}, 0.01,   1}, {{z, 1, "Initial Disturbance"}, 1, 10, 1}]The problem is that cascades are not being displayed inside the manipulate box.
Sort By:
Posted 11 years ago
 The main problem is that Monitor generates a separate cell for its output.     In[1]:= ?Monitor       Monitor[expr, mon] generates a temporary monitor cell in which the continually         updated current value of mon is displayed during the course of evaluation of expr. Your ControlActive has three arguments. I see only two arguments in the documentation examples. The Manipulate is in an infinite loop.  This can be suppressed by adding the TrackedSymbols option at the end of the Manipulate. For example, TrackedSymbols :> {z}
Community posts can be styled and formatted using the Markdown syntax.