Google Classroom
GeoGebraGeoGebra Classroom

slope of a first degree function

Points as Check Box

Points are well fitted to be used as Check Boxes since you can define its style and its color in a script. There are 10 different Point Styles, numbered from 0 to 9. We'll use
  • an empty point (Point Style = 2) for an unchecked option
  • a full point (Point Style = 0) for a checked option
When a checked option, represented by a point A, is correct, we'll color it green, when it's wrong we'll color it red, using the commands SetColor[A, "green"] and SetColor[A, "red"].
Image

slope of a first degree function

The graph of a first degree function kan be ascending, descending or none of both. In next applet you have to select the correct option. See how it works and make it yourself, following the construction steps.

Try it yourself...

Construction Steps

1-2Create the numbers a and b with the command RandomBetween[-4, 4].
3Define a function f as f(x) = Polynomial[a x + b]. Note: The command Polynomial[] prevents the equation to be displayed as e.g. 1x + 2.
4-6Toolbar ImageSelect the Point Tool and click three times in the Graphics to create the points A, B and C.
7-9Toolbar ImageSelect the Text Tool and create the texts is ascending, is descending and none of both. Align these three texts to the points A, B and C.
10Type the command ans = 0 to create a variable number ans.
11Type the command sol = If [a > 0, 1, If[a < 0, 2, 3]] to define the number sol. The value of sol is defined in a nested condition so that: - if a > 0 sol = 1 - if a < 0 sol = 2 - if a = 0 sol = 3
12Toolbar ImageSelect the Button Tool and create a button with capition new exercise and scripting commands UpdateConstruction[] to recalculate the Random numbers SetValue[ans,0] to set the value of ans back to its initial value 0 SetPointStyle[A, 2] to uncheck the points A, B and C SetPointStyle[B, 2] SetPointStyle[C, 2] SetColor[A, "blue"] to set the color of the points A, B and C to blue SetColor[B, "blue"] SetColor[C, "blue"]
13Toolbar ImageSelect the Text Tool and type the dynamic text selecting f in the list of available objects.

Scrips of the points

For checking and controlling the answer we add a script to each of the three points:
  • By clicking on A ans gets the value 1, by clicking on B ans = 2 and by clicking on C ans = 3.
  • When selecting one of the three points, it gets Point Style 0 (= full) the other two must be unchecked getting Point Style 2( = empty) and colored blue.
  • When making a good selection the selected point colors green if wrong it colors red.
Rightclick on the points and type in the Tab On Click of Scripting these scripts:
Image
the answer is controlled by dynamic coloring of the points. Here's shown how to work for point A. Now it's not hard to figure out how to do for B and C (with the corresponding values of ans).
Image