Re: How can I find the closest distance between a specified point and an interpolation curve?
- To: mathgroup at smc.vnet.net
- Subject: [mg27276] Re: How can I find the closest distance between a specified point and an interpolation curve?
- From: "Seth Chandler" <SChandler at Central.UH.Edu>
- Date: Sat, 17 Feb 2001 03:30:49 -0500 (EST)
- Organization: University of Houston
- References: <96is0i$dg6@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
The following should work in your case, although in general it will only find local minima bestpoint[ptset_,pt_]:= With[{fc=Interpolation[ptset]}, FindMinimum[With[{d={x,fc[x]}-pt},Sqrt[d.d]], Join[{x},{Min[First/@ptset],Max[First/@ptset]}]]] Example: bestpoint[{{0,0},{1,1},{3,4},{4,5},{6,8},{7,12},{8,15},{12,30}},{5,-5}] {7.02196,{x\[Rule]0.333778}} Seth J. Chandler University of Houston Law Center "liwen liwen" <gzgear at yahoo.com> wrote in message news:96is0i$dg6 at smc.vnet.net... > Dear friends, > Here is a curve that is produced by > Interpolation[PointSet] function, > Pointset={{0,0},{1,1},{3,4},{4,5},{6,8},{7,12},{8,15},{12,30}}. > > Fc=Interpolation[PointSet]. > the specified point is: > pt={5,-5} > I want to find the closest distance between the point > of pt and Fc ? > > Please help! > > Best regards, > Liwen 2/15/2001 > > __________________________________________________ > Do You Yahoo!? > Get personalized email addresses from Yahoo! Mail - only $35 > a year! http://personal.mail.yahoo.com/ >