Intersection Point between Functions at Interval-boundary missed

Angsüsser shared this problem 5 years ago
Not a Problem

I have 2 functions:

g(x) = If(0 ≤ x ≤ 1, 0.1x³ + 0.2x) and

h(x) = x - a ( a is a slider)


S=Intersect(g, h, 0, 1) fails for a=0 (S obviously should be (0,0)) and a=0.7 --> S(1,0.3) - even if I increase the "search-interval" this doen't help.

Comments (6)

photo
1

Hi Angsüsser! :)


The cause of the problem is the definition of g(x) or rather the boundaries.


The Intersect-command with boundaries needs an Intervall that is a little bit greater and it seems to be a connection between the increment of your slider and the boundary.


The Intersect-command without boundaries works fine (in this case).


Look at the modified file - I hope it explains it.


kind regards

mire2

photo
1

The Intersect-command without boundaries works fine (in this case) --> my problem arises from a branched function

(If(condition1, f1, cond2,f2, .....) so the "normal" intersect-cmd does not work - so this is no option here - as Isee!

Stays the problem: Intersection point MUST be an inner point.

The connection to the increment of the slider? Sorry I found no clue for it. Experimented with different increments vs. different interval-cecrements!

Conclusion: S must be an inner point - workaround: increment the interval boundaries by some epsilon!

But it's a warkaround and not consistent!

photo
1

Hi Angsüsser!


I think that the problems are caused by the method of finding intersection-points (and roots).

Both commands are "equal" - Finding the intersection-point of two functions f and g is solving the equation f-g=0.

The difference of both commands is only the second coordinate.

Only in some "trivial" cases the equation can be solved algebraically.

Assumption:

Finding roots, and so finding intersection-points, uses a numerical method and these method presume an open interval or rather finding solutions in an open interval.

In addition to you have also to check the boundaries.

It is like finding extremums of a piecewise given function - you have to check the boundaries additionally.

In ugly informal code:


If(g(0)-h(0)=0 than Point(0,h(0)) 
If(g(1)-h(1)=0 than Point(1,h(1))
Intersect(g,h,0,1)


Best regards

mire2

photo
1

OK - this explains a lot ( root vs. intersection point) - I supposed that there is some algorithm behind, that assumes open intervals. But wouldn't it be better to code this (check for boundary solution in geogebra) instead that the user himself has to check?

OK - when I know, I have to do this - then I do it. But I believe that's a hidden information - should be documented!

Thank you nevertheless for thinking over it

regards Hans

photo
2

Here the needed command - you have really to use "==" instead of "=". 


If(g(0)==h(0), (0, h(0)), If(g(1)==h(1), (1, h(1)), Intersect(g, h, 0, 1)))
You can see the difference in the attached file and I hope it solves your problem.Best regardsmire2

photo
1

Thank for the warning (==) and for the detailed guidance. So this problem can be tagged as solved!

Thank you mire2!

© 2023 International GeoGebra Institute