Google Classroom
GeoGebraClasse GeoGebra

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 y = 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. 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). See how it works in next applet and try it yourself following the construction steps.

Try it yourself...

Construction Steps

1Type the command a = RandomBetween(-3, 3) to create a number a.
2Type the command b = RandomBetween(-4, 4) to create a number b.
3Type the command sol(x) = a x + b to create a function sol. Note 1: Type a space between a and x. Note 2: Open the properties and define the title as l to look as a line.
4Type the command ans(x) = undefined to create a function ans. Note: Hide the graph of ans by clicking on the blue marble in the Algebra View.
5Toolbar ImageSelect the Text Tool and type the static text The equation of l is.
6Toolbar ImageSelect the Input Box Tool and create an Input Box with caption y = and select ans in the list of objects to link to. Rightclick in the Input Box to define its dynamic colors (see below).
7Toolbar ImageSelect the Button Tool and create a button with caption new exercise and scripting commands UpdateConstruction() SetValue(ans,undefined)

Image