Function from a list of points
Answered
I feel like I'm missing something here, but I can't seem to find a nice way to do this.
I'd like to create a *function* (with associated properties, i.e. it will accept an input from its domain and return an output from its co-domain etc) from a list of (x,y) points, so that it joins the points with straight lines.
Exactly like the polyline command does, except that does not return a *function* (it returns a 'polyline' which appears to be a number equal to the length of the lines created).
I can create a *freehand* function using the pen tool... but not a more simple linear piecewise one like this?
Am I missing a command?
For equally-spaced points:
For general points
although DataFunction() isn't designed for dynamic update so you need a bit of script trickery :)
https://www.geogebra.org/m/vdx5wcxh
To my knowledge, this command does not exist.
You can use the command:
y(Intersect(PerpendicularLine((<Xvalue>, 0), xAxis), <polyline>))
I think (not tested) it's possible to create a custom-tool with the command above.
.
Check also the commands Fit... for example FitPoly( <List of Points>, <Degree of Polynomial> )
and also the command Spline( <List of Points>, <Order ≥ 3>, <Weight Function> ) (not for functions)
https://help.geogebra.org/t...
For equally-spaced points:
For general points
although DataFunction() isn't designed for dynamic update so you need a bit of script trickery :)
https://www.geogebra.org/m/vdx5wcxh
Ah yes. I knew I'd seen a command that does something like I wanted - datafunction was it. Thanks to you all for the suggestions though!
I wonder if there's a scope for a function to do this automatically (and dynamically) - (i.e. sorts points, creates datafunction, and updates it if points move), since adding the script to every point is a little painful if we have lots of points...
create a list of points and add the script only to list
I have a solution with a function (ConvListetoFunc(<List of points>) which convert a freehand into a function.
The function may vary when then freehand is Moving !
I've created a file that turns a polyline into a dynamic function. The idea can be transferred from the points A, B, C, D to elements of a sorted point list.
Comments have been locked on this page!