Re: distance function
- To: mathgroup at smc.vnet.net
- Subject: [mg68743] Re: distance function
- From: "Ray Koopman" <koopman at sfu.ca>
- Date: Fri, 18 Aug 2006 03:11:43 -0400 (EDT)
- References: <email@example.com>
- Sender: owner-wri-mathgroup at wolfram.com
dimmechan at yahoo.com wrote: > In the book of Gaylord et al. (1996) there is one exercise which asks > (see page 113) > > "Given a list of points in the plane, write a function that finds the > set of all distances > between the points." > > Although there is one solution, that solution makes use of the Table > and Length commands. > > Is it a way to define the same function using Higher-Order functions > like Outer, MapThread etc? > > Thanks in advance for any help. Outer[ Norm[Plus[##]]&, coordlist, -coordlist, 1] where coordlist is an n x m array containing the coordinates of n points in an m-dimensional space.