listab = Shuffle({-3, -2, -1, 1, 2, 3})
- a = listab(1)
- b = listab(2)
to ensure that a and b are not equal numbers within a given range.
f1(x) = Polynomial(a x + b)
- f2(x) = Polynomial(a x - b)
- f3(x) = Polynomial(-a x + b)
- f4(x) = Polynomial(-a x - b)
- listf={ f1, f2 ,f3 ,f4 }
sol = RandomBetween(1, 4)
- f(x) = Element(listf, sol)
to show the graph of one of the four functionslistans= {"", f1, f2, f3, f4}
.
Rightclick on it an select in the tab Basic of the Properties the option Draw as drop-down list.
- ans = SelectedIndex(listans) - 1
( since the first option is a blank )
Red: If((ans ≠ 0) ∧ (ans ≠ sol), 1, 0)
Green: If(ans ≟ sol, 0.7, 0)
Blue: 0
UpdateConstruction[]
to recalculate all random values
SetValue[listans,1]
to set the drop-down list to blank