geogebra

test if a curve is above another


I have defined 2 curves. The definition is more complex than showed. This is only to be easily reproductible

c1: y= 2
c2: y=x+1 

I now want a curve c3 so that y=1 if c1 if above c2 and y=2 if c2 is above c1.

I wrote c3: y=If(y(c1)>y(c2),1,2)

No errors are raised by geogebra but it only print a line defined like this y=2.

Why does my test fail and how to fix it


Solution

  • You aren't using the correct syntax. This one works for me:

    f(x) = 2
    g(x) = x + 1
    h(x) = If(f(x) > g(x), 1, 2)
    

    Geogebra f(x), g(x), h(x)