Re: Identifying Last Point Preceding Last Vertical Tangent in a Data Set




In article <41cceb0d-5d72-48d1-ba62-43a5ba426fa9@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
monir <monirg@xxxxxxxxxxxx> writes:
Hello;

The title maybe a bit confusing and the question may not even belong
to this Newsgroup, but I'll go ahead with posting anyway expecting a
feedback either way!

1) I've a number of data sets (in the 100s), each set consists of N
analytically derived data points P(x,y) sequentially numbered 1, 2,
3, ..., N.

2) The data points per set appear at a first to be randomly
distributed, however a closer look would reveal that the first few
points are clustered in such a way resembling a rotational pattern.
In other words, if one joins the points by straight-line segments: P1-
P2, P2-P3, P3-P4, etc., one can easily see a rotational pattern
developing (in a clockwise direction starting at point 1) before the
rotation dissipates as the pattern flattens out approaching the outer
points.

3) All relevant points are in the 2nd quarter (i.e.; -ve X and +ve Y).

4) In my algorithm, I would like to identify (in a DO loop for each
data set, and with a reasonable level of confidence!) the index of the
point that is "most likely" be the LAST point preceding the LAST
vertical tangent. (Again, assuming it's a clockwise non-self-
intersecting smooth curve starting at P1).

5) Identifying the index +/- 1 would probably be good enough for the
task. (Hard to tell. It depends!!)

6) I've tried a couple of ideas so far with no success.

a- The first approach considers the angle between each successive 2
vectors. For example, if the angle between V21 and V23 is less than,
say, pi/2 (an arbitrarily-chosen angle) then P2 (i.e.; index=2) is
temporarily the last point. Repeat for V32 and V34, and update the
index to 3 if the angle at P3 is < pi/2, and so on. Didn't work!!!

b- The second approach joins points P1, P2, P3 by a circle with centre
at C(h,k), and saves the highest index of the point that satisfies:
x < h and y < k
Repeats for P2, P3, P4 and updates the index as applicable. Didn't
work!!!

7) I would be glad to post a couple of sample 8-point data sets to
avoid possible confusion or misunderstanding. This data could be used
also for validation purposes of whatever idea/numerical method one
could come up with. By plotting the sample data, one could visually
identify the LAST point likely to precede the LAST vertical tangent
for the data set. Such points would be clearly marked in the sample
numerical tables.
(In real life, however, interrupting the algorithm, plotting each of
the 100s data sets, visually identify the point index and then
continue would be impractical to say the least and it's not an
option!)

Any suggestions ?? Thank you kindly.
Monir

your data are P(i)=(x(i),y(i)) i=1,...,N
_ o r d e r f i x e d a n d g i v e n ??? _
and
you mean something like a spiral , and "flattens out" means that it
ends in a tail which can be represented by a function y(i)=f(x(i) )?
then do the following:
first compute the arclength of the piecewise linear arc connecting the
points:
t(1)=0
t(i+1)=t(i)+sqrt((x(i)-x(i-1))^2+(y(i)-y(i-1))^2) i=1,...,N-1
next compute _two independent_ splines under tension
s1 : s1 interpolates (t(i),x(i)) i=1,..,N
s2 : s2 interpolates (t(i),y(i)) i=1,..,N
chose the tension parameter such that the curve

x=s1(t)
y=s2(t) 0<=t<=t(N)
is not self intersecting.
now you have a smooth curve interpolating your data which should pretty
look like what you expect.
the tnagent vector is
(s1'(t),s2'(t))
(not normalized, but this is irrelevant here)
now, going down from t(N) to 0 , search for the first zero of s1' (t)
from the right: s1'(t)=0 means a "vertical" tangent.
(x=horizontal and y=vertical axis)
take the "next" point of the data set.
done
software for tension spline:
http://www.netlib.org/toms
toms/716
title: tspack
ref: TOMS 19,1
for: tension spline curve-fitting package
by: Renka
gams: e1a, e1c, k1a1a1, k1a1a3
size: 252 kB
Score: 100%
hth
peter
.