slope of a first degree function
- Author:
- chris cambré
Points as Check Box
Points are well fitted to be used as Check Boxes since ou can define its style and its color in a script.
There are 10 different Point Styles, numbered from 1 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
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-2 | | Create the numbers a and b with the command RandomBetween[-4, 4]. |
3 | | Define 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-6 | | Select the Point Tool and click three times in the Graphics to create the points A, B and C. |
7-9 | | Select 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. |
10 | | Type the command ans = 0 to create a variable number ans. |
11 | | Type 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 |
12 | | Select 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"] |
13 | | Select 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.
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).