User-defined functions from Objects to values?

André Szabolcs Szelp shared this question 1 year ago


I know you can define numerical functions in Geogebra f: R^n -> R.

I also see how you can define functions ("Custom Tools") that take objects as input and an object as output.

What I am missing is how I can define a function from Objects to a numerical value?

The numerical variables do not appear in the dropdown of output objects when creating a custom tool.

So while I can write the definition of a function, and assign it to a value:

my_dist = Distance(A,B)^2

I cannot define a user defined function (or custom tool).

Neither the my_dist(x,y) = Distance(x,y)^2 work, nor the definition of a custom tool, because the variable assignment is not offered as an output template object.

But I'd enjoy doing

X=(0, my_dist(C,D)).

What can I do, or did I miss an option?

Comments (2)


Also, from error messages I see how these user defined tools are internally called "Macros". But is there any way to edit them ex-post? I.e. after creation?

I find it hard to have to rebuild the whole construction if I want to redefine it just slightly.


numbers are shown in outputs


also you can open and modify the tool in version 5 of GG


the inputs and outputs of a tool must remain equal for editing

© 2020 International GeoGebra Institute