0

I have a set of plotted X,Y data points making a curve as shown below in the black line. What i need to do is draw a line from each of the X,Y s to all of the other XYs to determine the one with the highest slope for each point.

any line that intersects the curve more that 2 times IE the green line below are invalid. Can you think of a way to find all the common points of the Line and the curve given that i have all the XY to define the curve and all the XY at either end of the lines

here are some sample datapoints

POINT   x       y       Slope
1       0.00    1.00    #DIV/0!
2       0.79    -1.00   -2.55
3       1.57    -4.00   -3.18
4       2.00    -7.00   -4.00
5       2.36    -2.00   -1.27
6       2.55    8.00    2.75
7       3.14    12.00   3.50
8       3.93    -0.71   -0.43
9       4.71    0.00    -0.21
10      5.50    0.71    -0.05
11      6.28    1.00    0.00
12      7.07    0.71    -0.04

grid

graph

this is a beter picture illustrating the slopes being all over the place so i am not sure if finding m+1 being a lesser value will work

Ok FleaBlood I am not understanding Ill include another graph and table to clarify

R.Merritt
  • 101
  • 1
  • Do you have a definition for the curve? Otherwise there exist lots of curves passing through those points. – Jay Zha Jul 28 '17 at 15:45
  • To me this question is indeed about mathemathics but if you mainly concern about the implementation you can go to stackoverflow for example. – Plain_Dude_Sleeping_Alone Jul 28 '17 at 15:49
  • Are the x distinct (i.e. is this a function)? If not how do you determine which curve connects the dots? Is the final goal to only keep the point with the highest slopes with a point? If so you don't need to worry about crossing lines and a those slopes will not be the highest slope. – fleablood Jul 28 '17 at 15:52
  • hey dude I looked there couldnt find an example? stackoverflow – R.Merritt Jul 28 '17 at 16:50

1 Answers1

0

Hint: If a line (such as the green one) passes through the curve then there is an "earlier" slope that was greater than it.

The lines that don't pass through twice have to all have been the maximum of all the slopes before it, and minimum of all the slopes to come. If any later slope is less than it, then it passes the curve twice.

So measure slopes $m_1, m_2, m_3, m_4$. If you ever get a slope where $m_{i+1} \le m_i$ then $m_{i+1}$ and all the previous slopes, $m_j$, so that $m_{i+1} \le m_j \le m_i$ pass through the curve twice.

fleablood
  • 124,253
  • this doesn't seem to work as the slopes can vary being less or more than the previous. the only sure sine to disqualify a line is if it has more than 2 points in common with the curve ...the 2 points being the start and end points of the line. – R.Merritt Jul 31 '17 at 22:14
  • Draw it and you'll see that it can't. Let x be first point and let a,b,c be points so that x-c crosses the curve somewhere between a and b. Notice that means that the slope of x-c must be between the slope of x-a and the slope of x-b. – fleablood Jul 31 '17 at 22:47
  • ok will do ...ill try to come up with a counter example. I removed all my images and will make a better descriptive one tonight – R.Merritt Aug 02 '17 at 18:18
  • ok have a look now LINE7 is the line that would be disqualified as it crosses the "curve" more that 2 times – R.Merritt Aug 07 '17 at 20:04