Example: equation of a line

lines and functions of first degree
In next applet one has to give the equation of a line. But answering in an Input Box with label [b]y =[/b] won't work just like that. GeoGebra will interprete an equation a x + b as a function and not as a line. If you want to define a line in an Input Box you need an equation of the form a x + b - y = 0 and this is not how we want to formulate it. [br]You can solve the problem by working with functions ... but not to telling you do. So you can create an Input Box with label y = in which the filled in text is assigned to a function ant(x). It looks like it is a line, but in fact it is a function that can be compared to a solution sol(x).[br]See how it works in next applet and try it yourself following the construction steps.
Try it yourself...
Construction Steps
[table][tr][td]1[/td][td][/td][td]Type the command [b]a = RandomBetween(-3, 3)[/b] to create a number a.[/td][/tr][tr][td]2[/td][td][/td][td]Type the command [b]b = RandomBetween(-4, 4)[/b] to create a number b.[/td][/tr][tr][td]3[/td][td][/td][td]Type the command [b]sol(x) = a x + b[/b] to create a function sol.[br][u]Note 1[/u]: Type a space between a and x.[br][u]Note 2[/u]: Open the properties and define the title as l to look as a line. [br][/td][/tr][tr][td]4[/td][td][/td][td]Type the command [b]ans(x) = undefined[/b] to create a function ans.[br][u]Note[/u]: Hide the graph of ans by clicking on the blue marble in the Algebra View.[/td][/tr][tr][td]5[/td][td][icon]/images/ggb/toolbar/mode_text.png[/icon][/td][td]Select the Text Tool and type the static text [b]The equation of l is[/b].[/td][/tr][tr][td]6[/td][td][icon]/images/ggb/toolbar/mode_textfieldaction.png[/icon][/td][td]Select the Input Box Tool and create an Input Box with caption [b]y =[/b] and select [b]ans[/b] in the list of objects to link to. Rightclick in the Input Box to define its dynamic colors (see below).[/td][/tr][tr][td]7[/td][td][icon]/images/ggb/toolbar/mode_buttonaction.png[/icon][/td][td]Select the Button Tool and create a button with caption [b]new exercise[/b] and scripting commands[br][b]UpdateConstruction()[br]SetValue(ans,undefined)[/b][/td][/tr][tr][td][/td][td][/td][td][/td][/tr][/table]

Information: Example: equation of a line