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.[br]Note that while working with functions sol and ans become sol(x) and ans(x).
Try it yourself...
Construction Steps
[table][tr][td]1[/td][td][/td][td]Type the command [b]lista= [/b][b]Shuffle({-3, -2, -1, -0.5, 0.5, 1, 2, 3})[/b] to create list a. [/td][/tr][tr][td]2[/td][td][/td][td]Type the command [b]a= [/b][b]lista(1)[/b] to create a number a.[/td][/tr][tr][td]3[/td][td][/td][td]Type the command [b]b= [/b][b]RandomBetween(-4, 4)[/b] to create a number b.[/td][/tr][tr][td]4[/td][td][/td][td]Type the command [b]sol(x): a x + b[/b] to define the function sol(x).[/td][/tr][tr][td]5[/td][td][/td][td]Type the command [b]ans(x)=undefined[/b] to define the function ans(x)[/td][/tr][tr][td]6[/td][td][icon]/images/ggb/toolbar/mode_text.png[/icon][/td][td]Select the Text Tool and ceate the text [b]The eqution of f is[/b].[/td][/tr][tr][td]7[/td][td][/td][td]Select the Input Box Tool and create an Input Box with label =, linked to the object [b]empty[/b].[br]Rightclick in the Input Box to open its properties. [br]Type the command [b]SetValue[ans, %0][/b] in the tab On Click of the tab scripting.[br]See below for the Dynamic Colors of the Input Box. [/td][/tr][tr][td]8[/td][td][icon]/images/ggb/toolbar/mode_textfieldaction.png[/icon][/td][td]Select the Input Box Tool and create an Input Box with [b]label f(x) =[/b], linked to the object [b]ans[/b].[br]Since [b]ans[/b] is undefined the inputbox will show empty. [br]See below for the Dynamic Colors of the Input Box. [/td][/tr][tr][td]9[/td][td][icon]/images/ggb/toolbar/mode_buttonaction.png[/icon][/td][td]Select the Button Tool and create a button with label [b]new exercise[/b] and scripting commands:[br][b]UpdateConstruction()[br]SetValue(ans, undefined)[/b][/td][/tr][/table]
Dynamic Colors of the Input Box

Information: Example: equation of a function