combine graphs and equations

images of graphs
We want to combine the graphs of 4 functions with their equation. First we have to do some preparational work creating the images of the graphs. You can export the Graphics View as a picture (see the [url=https://wiki.geogebra.org/en/Export_Graphics_Dialog]manual[/url]).[br]Read the article in the manual and save the picture of the four following functions on your computer:[br][list][*]f(x) = x²[/*][*]f(x) = x² + 2[/*][*]f(x) = (x + 2)²[/*][*]f(x) = -x²[/*][/list]In the [url=https://wiki.geogebra.org/en/Image_Tool]manual[/url] you can read how to insert pictures in an applet.
drop-down lists
To match the graphs with their equation we can use drop-down lists in which we can select the appropriate answer out of the options A, B, C or D and showing a blank answer as its initial position.[br][list][*]Type the command [b]list1= {"", "A", "B", "C", "D"}[/b][/*][*]Rightclick on the list in the Algebra View to open its Properties.[/*][*]Select the tab [b]Basic[/b], check the option [b]Draw as drop-down list[/b] and type [b]graph[/b] as its Caption.[/*][*]Define [b]ans1= SelectedIndex[list1][/b]. When you select the option A ans will be equal to 2. At its initial position (a blank answer) ans1 will be equal to 1.[/*][/list]
Try it yourself...
Construction Steps
[table][tr][td]1-12[/td][td][icon]/images/ggb/toolbar/mode_image.png[/icon][/td][td]Select the [b]Picture Tool[/b] and insert the pictures of the four graphs.[br]Align them in the Graphics by dragging the defining corners.[br]Hide these defining corner points afterwards.[/td][/tr][tr][td]13-16[/td][td][icon]/images/ggb/toolbar/mode_text.png[/icon][/td][td]Select the [b]Text Tool [/b]and mark the graphs as A, B, C and D.[/td][/tr][tr][td]17-20[/td][td][icon]/images/ggb/toolbar/mode_text.png[/icon][/td][td]Select the [b]Text Tool [/b]and type the four equations of the functions.[/td][/tr][tr][td]21-24[/td][td][/td][td]Define the four lists and draw them as drop-down lists behind the equations.[br][u]Attention[/u]: Make sure list1 is situated behind f[sub]1[/sub] etc.[/td][/tr][tr][td]25-28[/td][td][/td][td]Define the fours answers as: [b]ans1 = SelectedIndex[list1][/b] etc.[/td][/tr][tr][td]29[/td][td][icon]/images/ggb/toolbar/mode_buttonaction.png[/icon][/td][td]Select the Button Tool and create a button with Caption [b]reset[/b] and scripting commands[br][b]SetValue[list1,1][/b] to reset all four drop-down lists to their initial blank position[br][b]SetValue[list2,1][br]SetValue[list3,1][br]SetValue[list4,1][/b][br][/td][/tr][/table]
dynamic colors of the drop-down lists
Again we can use dynamic colors to control the selected answers.[br][list][*]f[sub]1[/sub] = x² matches with graph D. [/*][*]The list colors red if the selection is wrong. That's if it isn't blank (ans [math]\ne[/math] 1) and neither D (ans [math]\ne[/math] 5).[br][/*][*]The list colors green if the selection is correct. That's if D is selected (ans = 5).[br][/*][/list]The other lists are colored similarly.
Similar exercises
Numerous exercises can be made in a similar way combining slopes, signs, equations, derivates, graphs, a list of its roots or asymptotes, axes of symmetry...

Information: combine graphs and equations