Example: equation of a function

function of first degree

In next applet one has to give the equation of the function. See how it works and make it yourself, following the Construction Steps. Note that while working with functions sol and ans become sol(x) and ans(x).

Try it yourself...

Construction Steps

1Type the command lista= Shuffle({-3, -2, -1, -0.5, 0.5, 1, 2, 3}) to create list a.
2Type the command a= lista(1) to create a number a.
3Type the command b= RandomBetween(-4, 4) to create a number b.
4Type the command sol(x): a x + b to define the function sol(x).
5Type the command ans(x)=undefined to define the function ans(x)
6Toolbar ImageSelect the Text Tool and ceate the text The eqution of f is.
7Select the Input Box Tool and create an Input Box with label =, linked to the object empty. Rightclick in the Input Box to open its properties. Type the command SetValue[ans, %0] in the tab On Click of the tab scripting. See below for the Dynamic Colors of the Input Box.
8Toolbar ImageSelect the Input Box Tool and create an Input Box with label f(x) =, linked to the object ans. Since ans is undefined the inputbox will show empty. See below for the Dynamic Colors of the Input Box.
9Toolbar ImageSelect the Button Tool and create a button with label new exercise and scripting commands: UpdateConstruction() SetValue(ans, undefined)

Dynamic Colors of the Input Box

Dynamic Colors of the Input Box