Using a Line as a function (getting a value)

gbell12 shared this question 5 years ago
Answered

If I create a function by entering it into the input bar:

g(t) = 4t + 5


I can then call the function with an input value

g(5)

or

g(15)


However, when I ask GeoGebra to make a Line:

Line[(5,2), (3,1)]


It creates something that sort of looks like a function:

h:x-2y=1


Yet I can't treat it as such:


h(5)

=-0.5

h(9)

=-0.5


What concept am I missing? I've scoured the documentation. I investigated Paths a bit but didn't get far.


I note that I can execute h(x) and GeoGebra then creates a function (say r(x)) which I can use! What's happening there? Again, I'm missing a concept or two here.


Many thanks.

Comments (7)

photo
1

h is a line

try y(intersect[h,x=9]) for h(9)


also you can define g(x)=-(x(h) x+z(h))/y(h) if you want the function


saludos

photo
1

Thanks @mathmagic! That's perfect. For reference, I found a near-duplicate here.


"also you can define g(x)=-(x(h) x+z(h))/y(h) if you want the function"


What's the concept there? I know the x() and y() functions to pull the coordinates from a point...


And that seems to do the same thing as h(x). But what's the GeoGebra operation/concept happening there?

photo
1

x(h) y(h) z(h) are A,B,C for the line h:Ax+By+C=0

photo
1

Actually this is a bug, fixed for next release.

photo
1

Do you mean that "x(h) y(h) z(h) are A,B,C for the line h:Ax+By+C=0" is not supposed to be used that way, and this is a bug?

photo
1

no, actually you can do a:3x-7y=1, then a(4) answer 11/7

photo
1

Understand now.


Original h(9) =-0.5, h(5)=-0.5 was the bug.

photo
© 2021 International GeoGebra Institute