# Thinning up a pointList with distance-criterion?

Angsüsser shared this question 3 years ago

I have a solution of 2-dim ODE and constructed points in phase-space with:

p=First(numericalIntegral1, Length(numericalIntegral1))

f=First(numericalIntegral2, Length(numericalIntegral2))

pf=Zip((y(aa), y(bb)), aa, p, bb, f)

pf has about 1000 points, some of these are very dense (direction-field is "low" there) some are not. To apply the Spline-method to the pointlist pf is out of question, so I have to thin up "pf" so that the points have almost the same distance to each other.

The algorithm I thought of (only a proposal - any other algorithm is appreciated)

1) Use pf[1] as reference point R

2) Search all the points of "pf" with distance (R,pf[i])>d and distance(R,pf[i_m])=Minimum

(a kind of supremum: smallest upper bound in pf)

3) Remove all points from "pf" with distance (R,pf[i])<=d

4) Use pf[i_m] as R now and goto 2)

until pf is {}

But I do not see how to implement this in Geogebra-Script.

Any idea? Thank you for thinking about it!

1

1

Here it is:

1

yo uso otro procedimiento que se me ocurrió y que creo que GG lo aguanta bien y que es más facil de controlar y claro en la vista algebraica

creo que el comando funcion está infrautilizado

Files: foro.ggb
1

OK - a good idea to use the freehand tool - I did not even know that it exists. It's not an algorithm - but why not use my own brain? Saves a lot of thinking.

Thanx mathmagic

1

One solution more.

Based on a transformed Pathparameter (transformed from vertex to length)

1

How can you handle the freehand-tool in such an accurate way? I see no deviation to the original curve?

If I handle this tool with my mouse - it looks like a parkinson patient do drawing exercises!

1

@rami

1) That is precisely what I was looking for

2) "One solution more" - you are loving understatement! This solution is ingenious in my point of view and

3) to understand why it is working I shall have to do a lot of brain-work. The idea of a "density-norm" is fantastic clever.

Thank you that you thought about it - at the end it is my problem not yours - thanx

1

Sorry, a bug:

The last segment (from end to start) is not included in the length.

Correction: new object "Len" and use in "DensityNorm".

1

I thought of that: you used Polyline for the open path and Polygon for the closed path (in this case the difference is not important at all) - to call it a bug? At the most a little bit inaccurate. The intelligence is in the idea!

Greetings Hans

1

Thanks,

My bugs are no problem for me, although I try to avoid them. But all programs always have some bugs. Only some of them you don't see immediately.

1

si deseas un conjunto de puntos, no equidistantes, sino en tiempos regulares puedes añadir la instruccion Sequence(e(t), t, t_0, t_f,0.3) en mi archivo

ahí se observa en que periodos de tiempos son más estables las poblaciones

1

OK - that is clear enough. But how can you handle the "freehand"-tool in such an accurate way?

1

freehand is the type of object in geogebra. I only build the function(begin,end, values of y coords of points in numericalintegral) look at help of function() command

first epigraph

1

Clever - I did not know that command. In the construction protocol this "function command" was denoted by

"freehand(x)" - so I believed you used the freehand tool from the menu!

1

@mathmagic&rami

Thank you folks - I have learned a lot - keywords "PathParameter" and how to use it with Polyline, "freehand-tool" in context with "Function-command" and more!

Thank you!