Since the original post of mine, which is below, is too long, too complicated and time-consuming for others, I tried to mimic the same structure with a very simple code
. I want to calculate $x=alfa+beta$ by choosing a random seed. If output $x$ is less than 0.5, then I analyze $x$, otherwise I only want to dynamically change $beta$ (which is the case below), while keeping the seed value of $alfa$ unchanged. But this change in $beta$ should be done only if I click on the slider for $beta$. If I get $x1>=0.5$, then I analyze $x1$. The logic is similar to Do
loop, with a difference that I am trying to adjust $alfa$ and $beta$ to get the desired output.
Any idea is appreciated.
DynamicModule[{alfa, beta},
Manipulate[
SeedRandom[seed];
alfa = RandomReal[];
beta = RandomReal[{-1, 1}];
x = alfa + beta;
If[x < 0.5, x, x1 = alfa + beta],
{{seed, 1, "seed"}, 1, 100, 1},
{{alfa, 0.5, "alfa"}, 0, 1, 0.02},
{Slider[Dynamic[beta], {-1, 1}], Dynamic[beta]},
TrackedSymbols :> True, ContinuousAction -> False,
SynchronousUpdating -> True
]
]
I am editing the above code
with Manipulate
within Manipulate
, Let us call this edited code
as Edit 1:
Manipulate[
SeedRandom[seed];
Pause[2];
alfa := RandomReal[1, 20];
Manipulate[
Plot[{Sin[a y], Sin[a1 y]}, {y, 0, 10}],
Row[{Control[{a, alfa, Animator, AnimationRunning -> False}]}],
Row[{Control[{a1, alfa*(1 + 0.5), Animator,
AnimationRunning -> False}]}],
SaveDefinitions -> True
],
{{seed, 1, "seed"}, 1, 100, 1}
]
Edit 1 produces the desired output, though I like to make a Slider
for $0.5$ in the second Control
command. As one may see, the first Manipulate randomizes $alfa$ and the second Manipulate
adjusts $alfa$ to the desired level. In this example, the adjustment value is set to $0.5$ in the second Control
command. If I can make this adjustment value as a Dynamic Slider (for updating purposes), that will answer my question.
If
statement, theManipulate
command will be closed, but then I want to be able to adjust $alfa$ and $beta$ to the desired values. That is why I want to use $alfa$ and $beta$ in theSlider
formats. However, I want to adjust the parameters one at a time, not likeSeedRandom[]
does. I hope my explanation makes sense. $\endgroup$