Re: Algorithm for distance from point to function
- From: "e p chandler" <epc8@xxxxxxxx>
- Date: 15 Jul 2006 12:26:34 -0700
glen herrmannsfeldt wrote:
Thomas Koenig wrote:
Mike.Prager <mike.prager¿@noaa.gov> wrote:
Does there exist any reasonably general algorithm for computer
the distance between the point (x,y) and a function y = f(x)?
Minimize sqrt((xi-x)**2 + (f(xi)-y)**2).
There may be local minima, so you might want a routine that
is good at finding a global minimum. It is only one dimension,
so it shouldn't be too hard.
I usually look in Numerical Recipes.
-- glen
There are at least two ways to look at this. Suppose that the point is
(a,b).
1. Simplify the problem by minimizing the distance squared instead of
the distance. See the recent discussion in this newsgrop of Cernlib's
MINFC.
2. Take the derivative of the distance squared and set it equal to
zero. Equivalently, note that the distance will be minimal where the
line from the point to the curve is perpendicular to the tangent line
to the curve or when their slopes are negative reciprocals.
(y-b)/(x-a) f'(x) = -1 where y=f(x), solve for (x,y).
-- elliot
.
- References:
- Algorithm for distance from point to function
- From: Mike . Prager
- Re: Algorithm for distance from point to function
- From: Thomas Koenig
- Re: Algorithm for distance from point to function
- From: glen herrmannsfeldt
- Algorithm for distance from point to function
- Prev by Date: Re: Algorithm for distance from point to function
- Next by Date: Re: FORTRAN grid plotting on a map.
- Previous by thread: Re: Algorithm for distance from point to function
- Next by thread: Re: Algorithm for distance from point to function
- Index(es):
Relevant Pages
|