I am trying to create a question in a question bank using the formula question, but I need variable a to be larger than variable b when generating a list of solutions. How can I accomplish this without restricting variables a and b when defining them? Here is my formula: a*((b*c)/(a-b)). The formula works fine. How do I restrict a to be larger than b?

You don't do this without specifying different ranges for [a] and [b] to make sure a > b.

That's actually more important than you realize, though, because if you don't, then [a] and [b] might be the same and then you would have division by 0 (a very bad thing). That is part of why Canvas forces you to generate all of the options ahead of time -- to make sure weirdnesses don't happen while students are taking a quiz.

Depending on how many cases you're generating, you might be lucky and not end up with division by 0, so it

mightwork out, but you might need to generate more than one time to get all the cases you need.If you absolutely need the order of the numbers to be random (not always listing the bigger one first) and you are willing to click the generate button until you don't have any division by 0 issues, then you might be able to work around it depending on why you need a > b. Follow the logic below to see why.

a*((b*c)/(a-b)) is really a*b*c/(a-b) or max*min*c/(max-min)

The commutative property of multiplication tells us that: a*b*c = a*c*b = b*c*a = b*a*c = c*a*b = c*b*a

So max*min*c = min*max*c and it really doesn't matter which is larger and which is smaller for the numerator. It's the denominator you need to worry about.

If the only reason you need a > b is to make sure that the answer turns out positive because your instructions involve "the difference between a and b" and you don't know which one is bigger, then use the abs() function and write your formula as

a*b*c/abs(a-b)If [a] and [b] are part of an algebraic expression, where subtraction is not commutative but the student doesn't know about negative numbers, or if you need [a] to be bigger than [b] for question purposes, like "If you have [a] moles of chemical A and [b] moles of chemical B ... ", then you will need to specify that in the interval definitions.

You cannot have generated variables in a question, so while you might want to do so, you cannot put [max(a,b)] in a question, nor you can define a variable x=max(a,b) and then put [x] in the question.