I'm making a demonstration with the following code:
a = Pi/4;
b = 3 Pi/2;
f[x_, n_] = Piecewise[{{x + Sin[x] + n, x >= Pi}, {x + Sin[x], x < Pi}}];
Manipulate[
Plot[
f[x, n], {x, -Pi, 2 Pi + 1},
PlotRange -> {{-1, 2 Pi + 1}, {-1, 2 Pi}},
Epilog -> {
Table[{Dotted, Line[{{-1, q}, {2 Pi + 1, q}}]}, {q, {f[a, n], f[b, n]}}],
If[n == 0, {Dashed, Line[{{-1, f[c, n]}, {2 Pi + 1, f[c, n]}}]}, {Dashed, Line[{{-1, k}, {2 Pi + 1, k}}]}]
},
Ticks -> False,
Axes -> False
],
{{n, 0}, {0, Pi/2}},
{{c, Pi}, a, b},
{{k, f[a, n], "K"}, f[a, n], f[b, n]}
]
When n=0 is selected, the k slider does nothing; when n=Pi/2, the c slider does nothing. Is there some way to hide the k and c sliders under the conditions for which they're inactive?
(Bonus points: For convenience, I'd like to post an animation of what happens for users who can't run it in Mathematica on their own, so if someone could post instructions or a link to where I can learn to make a screen-cap, I would greatly appreciate it!)
nso that it can only be toggled between0andPi/2. My intention here is to demonstrate the Intermediate Value Theorem, which holds when usingf[x, 0], but not when usingf[x, Pi/2]. – user170231 Jun 23 '15 at 16:38Enabledlike{{c, \[Pi]}, a, b, Enabled -> n == 0},{{k, f[a, n], "K"}, f[a, n], f[b, n], Enabled -> n != 0}– Junho Lee Jun 23 '15 at 17:05