equation of a function

graph of a random defined function and the corresponding equation

In next applet a graph of a random defined first degree function is shown. The user has to select the corresponding equation in a drop-down list. See how it works and make it yourself following the construction steps.

Try it yourself...

Construction Steps

1Type the command listab=Shuffle[{-3, -2, -1, 1, 2, 3}] to create listab
2-3Type the commands a = listab(1) and b = listab(2) to create a and b.
4-7Define the functions f1, f2, f3 and f4 as: f1(x) = Polynomial[a x + b], f2(x) = Polynomial[a x - b] f3(x) = Polynomial[-a x + b], f4(x) = Polynomial[-a x - b] Hide the graphs.
8Type the command listf={f1, f2, f3, f4} to create a list that contains the four functions.
9Type the command sol = RandomBetween[1, 4] to create the number sol.
10Type the command f(x)= Element[listf, sol] to define the function f shown in the Graphics.
11-14Toolbar ImageSelect the Text Tool and create four dynamic texts with the equations on the functions.
15Type the command listans ={"", text1, text2, text3, text4} and draw it as a drop-down list.
16Type the command ans= SelectedIndex[listans] - 1 to create the number ans.
17Toolbar ImageSelect the Button Tool and create a button with Caption new exercise and commands: UpdateConstruction[] to recalculate all random defined objects SetValue[listans,1] to reset the drop-down list to its initial blank position.
To give feedback you can define the dynamic colors of the list as follows: