In manipulate, I need to define two sliders : one basic slider, and a second one for which the end value depends on the current value selected on the first slider. How can I achieve this in Mathematica 7, without having a red glow when the second parameter is out of range ?
Here's a nice MWE code to work with :
UPDATE : I updated the MWE below, to show the annoying red glow on the second slider :
Manipulate[Plot[A Sin[2 Pi f t/12], {t, 0, 12},
PlotRange -> {{0, 12}, {-1, 1}},
AspectRatio -> 1,
Frame -> True,
Axes -> True,
ImageSize -> 600],
Row[{
Control[{{f, 1, "frequency"}, -10, 10, 0.01, Appearance -> {"Labeled", "Closed"}}],
Spacer[125],
Control[{{A, 0.1, "Amplitude"}, 0, Dynamic[Which[f < 0, 0.5, f >= 0, 1]], 0.01, Appearance -> {"Labeled", "Closed"}}]
}],
ControlPlacement -> Bottom
]
This working code shows a simple oscillation with 2 adjustable parameters : a frequency (from -10 to 10) and an amplitude (from 0 to 0.5 if f < 0, and from 0 to 1 if f > 0). The amplitude parameter is partly dependant on the frequency selected.
When the amplitude is set to its max value on its slider (or close to it), and then lower the frequency a bit, the amplitude slider may get a red glow as a warning that it is now out of range. I want to remove that annoying behavior. If the amplitude is already close to its max value, and you lower the frequency to a negative value, the amplitude value should adapt so it's never out of range. It should automatically be "dragged" to its maximum value instead of find itself out of range.
What would be the simplest way to achieve this in the manipulate code above ?
A = Min[A, Which[f < 0, 0.5, f >= 0, 1]];
or equivalent before the Plot? $\endgroup$