Re: Algorithm for distance from point to function



Terry wrote:

The minimum distance is the length of the shortest line from the point
x1y1 to a tangent to the line y=f(x). The equation of the tangent is a
line whose slope is the first derivative at x2y2. The point x2,y2
satisfying the function and at the shortest distance is the
intersection of a line through x1y1 which is perpendicular to the
tangent at x2,y2 and therefore has a slope of the inverse of the tanget
(or the reciprocal of the first derivative at that point).
Then the distance is just the normal Gausian square rooot of the sum of
the squares of the differences between each coordinate of the pair
x1,y1; x2,y2
Searching by closer approximations is the best technique.

Thanks to all who posted hints. We had indeed been planning
to use an optimization in finding the shortest distance. The
function to which we are finding distance is monotonic, and I
think that will simplify things a bit. It may even be
possible that we can use the derivative of the distance --
we'll have to examine that closely.

I was hoping that there might be a magic bullet we had
overlooked, but (not surprisingly) it appears not.

Because the distances are needed for an outer optimization
(fitting by least squared distances), this is becoming
computationally intense. Luckily, the data sets are small.

....Mike

Mike Prager
North Carolina, USA
.



Relevant Pages

  • Re: asymptote/hyperbola?
    ... >> In this case, roughly, the tangent at very large distances. ... There's a better picture here: ... Beyond a certain distance, the ... rompe l'orologio e invece di presentarsi alle nove si presenta alle ...
    (rec.arts.books)
  • Re: Racing cars on a track
    ... Okay the tangent on the North direction is 470 while the distance to ... the low point from the radius is 469 on the 315 azimuth. ... r is the radius distance to the midpoint of the inside curve ...
    (sci.math)
  • Re: Racing cars on a track
    ... Okay the tangent on the North direction is 470 while the distance to ... the low point from the radius is 469 on the 315 azimuth. ... r is the radius distance to the midpoint of the inside curve ...
    (sci.math)
  • Re: Algorithm for distance from point to function
    ... The minimum distance is the length of the shortest line from the point ... x1y1 to a tangent to the line y=f. ... intersection of a line through x1y1 which is perpendicular to the ...
    (comp.lang.fortran)
  • Re: Shortest Distance between a point and a functi
    ... the shortest distance between the point and fwould be ... directly on the line perpendiculer to the tangent line on a ... the slope of this tangent line is f'and the slope of ... find intersections: ...
    (comp.soft-sys.matlab)