# right click, ClosestPoint, arithmetic functions combinations

persil shared this problem 6 years ago

In input fields (including object settings), after making a selection of a text, right-mouse-click doesn't open the menu with editing options.

If I define two functions using f(x)= and g(x)=, when I attempt to define the sum (or any other arithmetic combination) function using (f+g)(x), the sum of f and g is multiplied by x.

In the attached file, the ClosestPoint command sometimes doesn't seem to correctly identify the point on the curve closest to the point on the circle. Just click GO and observe how point C is defined as point A travels around the circle.

Thanks.

https://ggbm.at/565337 1

(f+g)(x)

Try f(x) + g(x).

The ClosestPoint command uses a numerical method for functions:

http://wiki.geogebra.org/en... 1

Thanks for a quick response, murkle.

Try f(x) + g(x).

I know I can do f(x) + g(x) or even f+g and that will define a new function that will be named say h(x). I pointed it out since arithmetic combinations of functions are often discussed in education and it's very common to name say the sum function f+g instead of a single letter. I was just wondering if it's possible to implement such notation in Geogebra so that once f(x) and g(x) are defined, the command say (f+g)(5) will actually return the result of f(5)+g(5). 1

The ClosestPoint command uses a numerical method for functions

Since it works well for polynomials, do you know if the numerical method uses Taylor polynomials? If not, maybe you could replace the original function with its Taylor polynomial of reasonable order (in terms of computation time) and somehow use the result of the ClosestPoint command applied to that Taylor polynomial. 1

Does that method work for your example? 1

Does that method work for your example?

I'm trying now but I face a strange complication. I tried with function f(x)=x^x. Taylor polynomial of order 100 returned undefined. When I tried to just change the order in the definition of the function by replacing 100 with 10, the error message "Invalid input: TaylorPolynomial[f, 2, 10]" popped out. I had to delete the original attempt and define it again "from scratch". But with the order 10 Taylor polynomial it worked much better. In my example, I only try to approximate the reflection across the curve though so it's definitely sufficient. I'll adjust my file later today and post it so you can compare the resulting reflections using the original function and the Taylor polynomial approximation. 1

Hi

Thanks for a quick response, murkle.

Try f(x) + g(x).

I know I can do f(x) + g(x) or even f+g and that will define a new function that will be named say h(x). I pointed it out since arithmetic combinations of functions are often discussed in education and it's very common to name say the sum function f+g instead of a single letter. I was just wondering if it's possible to implement such notation in Geogebra so that once f(x) and g(x) are defined, the command say (f+g)(5) will actually return the result of f(5)+g(5).

Ahhhh Mathematic's notations...

In France, we don't write A=(1,1) but A(1;1) :D

Mathematic's logic is not the same as Computing's logic...

At the beginning, this is the logic :

An object is defined by a name , a separator ( = or : ) and a value or a definition

A=(1,1)

B=Point[a]

d:y=x+1

Then, Mathematic 's teacher asked for this notation

f(x)=2x

(because it is the same as Mathematic's notations...)

But it is completely illogic !

The logic is

f=2x

(in the first versions of GeoGebra, we had to write this...)

So now, there is no logic... and it is a little strange...

If we write

f(x)=2x > Ok

f=2x > Error

If we write

h(x)=f(x)+g(x) > Ok

h=f+g > Ok

If we write

f(3)+g(3) > Ok

(f+g)(3) > Error 1

I'm trying now but I face a strange complication. I tried with function f(x)=x^x. Taylor polynomial of order 100 returned undefined.

Also big engines supported by big calculators feel a shiver running down their spine while calculating that...

... wolfram alpha stops showing results at the 4th order.... :smiley_cat:

(and just for the sake of it, in Italy we use the notation f(x)+g(x) ) 1

I've tried two methods alternative to the ClosestPoint with respect to the original function, Taylor polynomial approximation and a "distance function" which minimum should be calculated to determine the closest point. It looks like for the y=x^x function both methods work pretty well but if the original function is more complicated, both methods might fail. Anyway, have a look at the attached file.

https://ggbm.at/565393