Google Classroom
GeoGebraGeoGebra Klaslokaal

dynamic colors

Introduction

Following applet illustrates two ways to use dynamic colors.
  • The colors of the sign of a function f and the color of a Point P depent on a given condition.
  • The colors of a slider s and a point C are calculated out of a variable value.
  • sign of a function: The sign of a function f(x)= ax + b depends from the values of a and b.
  • color of a point P: Point P colors green when it's on the graph of f and red if it's not.
  • color of a slider: The color of slider s changes while moving the slider.
  • color of a point C: The color of point P changes if you drag it along the segment l.

How do you do this?

  • Sign of the function f: Create: - a slider a from -4 to 4 with increment 0.5 - a slider b from-4 to 4 with increment 0.5 - a function f(x) = a x + b - a number zero = -b/a - a number c = Integral(f, -50, zero) - a number d = Integral(f, zero, 50) Open the Properties of c and d, select the tab Advanced and define their dynamic colors so that a negative value will color red and a positive value will color green.
    colors of ccolors of d
    Red:If(c < 0, 1, 0)If(c > 0, 0.7, 0)
    Green:If(d < 0, 1, 0)If(d > 0, 0.7, 0)
    Blue:00
  • Color of the point P: Create a point P, open its Properties and select the tab Advanced. Define its colors so that P colors green when it's on the graph and green when it's not.
    Red:If(Distance(P, f) > 0, 1, 0)
    Green:If(Distance(P, f) ≟ 0, 0.7, 0)
    Blue:0
    
  • Color of the slider s: Create a slider from 0 to 1 with increment 0.1. Define its color in the tab advanced of its Properties:
    Red:s
    Green0
    Blue1-s
    Moving the slider from 0 to 1 its color will change from blue to red.
  • Color of the point C: Create: - the Segment l between the points A and B: l = Segment(A,B). - the Point C on the segment. - the Segment g between the points A and C: g = Segment(A,C). Define its colors so that C will color from black to green while dragging it on the segment.
    Red:0
    Green:g/l
    Blue:0