1
$\begingroup$

I have a paragraph

Manipulate[ expr, { {a, 1}, 1, 4, 1}, { {b, 2}, 2, 5, 1} ] 

and I want variable b to be bigger than a at all times.

I have searched for help on this and one thread on this site mentions the functions Manipulate and Dynamic, but as I am new to Mathematica I don't fully understand the solution - and as I won't need Mathematica too much in the future it's not expedient for me to read through 5 page tutorials on both functions until I maybe get how both work.

Thanks in advance

$\endgroup$
2
  • $\begingroup$ Does this or linked topics answer your question?: Interdependent controls in Manipulate $\endgroup$ Commented Nov 26, 2016 at 19:33
  • $\begingroup$ Manipulate[a + b, {{a, 1}, 1, 4, 1}, {b, a + 1, a + 6, 1}] $\endgroup$ Commented Nov 26, 2016 at 20:14

2 Answers 2

2
$\begingroup$

You can assign dependencies between the Manipulate variables. For example:

Manipulate[If[b < a, {a, b} = {Min[a, b], Max[a, b]}]; {a, b}, {{a, 1}, 1, 4}, {{b, 2}, 2, 5}] 
$\endgroup$
0
$\begingroup$

Extending the comment by Alan with a TrackingFunction to ensure that also the value of b is increased whenever necessary:

Manipulate[a + b, {{a, 1}, 1, 4, 1, TrackingFunction -> (a = #; If[b <= a, b = a + 1]; &)}, {b, a + 1, a + 6, 1}] 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.